Documentation ¶
Index ¶
- Constants
- Variables
- func Bytes2String(data []byte) string
- func FnCallImpl(vm *VM, inst *asm.Instruction) error
- func FnGetCurrentPidTgidImpl(vm *VM, inst *asm.Instruction) error
- func FnGetSmpProcessorIdImpl(vm *VM, inst *asm.Instruction) error
- func FnKtimeGetNsImpl(vm *VM, inst *asm.Instruction) error
- func FnMallocImpl(vm *VM, inst *asm.Instruction) error
- func FnMapDeleteElemImpl(vm *VM, inst *asm.Instruction) error
- func FnMapLookupElemImpl(vm *VM, inst *asm.Instruction) error
- func FnMapUpdateElemImpl(vm *VM, inst *asm.Instruction) error
- func FnMemCmpImpl(vm *VM, inst *asm.Instruction) error
- func FnPerfEventOutputImpl(vm *VM, inst *asm.Instruction) error
- func FnProbeReadImpl(vm *VM, inst *asm.Instruction) error
- func FnProbeReadStrImpl(vm *VM, inst *asm.Instruction) error
- func FnSleepImpl(vm *VM, inst *asm.Instruction) error
- func FnStrCmpImpl(vm *VM, inst *asm.Instruction) error
- func FnTailCallImpl(vm *VM, inst *asm.Instruction) error
- func FnTracePrintkImpl(vm *VM, inst *asm.Instruction) error
- func GetHostByteOrder() binary.ByteOrder
- func Instructions(insts ...interface{}) asm.Instructions
- func JumpOpCode(class asm.Class, jumpOp asm.JumpOp, source asm.Source) asm.OpCode
- func ResolveReferences(insts asm.Instructions) error
- func ToBytes(data interface{}, size int) ([]byte, error)
- func UnmarshalCtx(data []byte) [16]uint16
- type BTInst
- type Context
- type DebugCommand
- type Debugger
- type Fncs
- type Heap
- type Logger
- type Map
- func (m *Map) Delete(key interface{}) (bool, error)
- func (m *Map) FD() int
- func (m *Map) Iterator() (*MapIterator, error)
- func (m *Map) KeySize() uint32
- func (m *Map) Keys() ([][]byte, error)
- func (m *Map) Lookup(key interface{}) ([]byte, error)
- func (m *Map) LookupAddr(key interface{}) (uint64, error)
- func (m *Map) Read() (<-chan []byte, error)
- func (m *Map) Update(key interface{}, value interface{}, kind MapUpdateType) (bool, error)
- func (m *Map) ValueSize() uint32
- func (m *Map) Write(data interface{}, size uint64) error
- type MapArrayStorage
- func (m *MapArrayStorage) Delete(key []byte) (bool, error)
- func (m *MapArrayStorage) Keys() ([][]byte, error)
- func (m *MapArrayStorage) Lookup(key []byte) (uint64, error)
- func (m *MapArrayStorage) Read() (<-chan []byte, error)
- func (m *MapArrayStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
- func (m *MapArrayStorage) Write(data []byte) error
- type MapCollection
- type MapHashStorage
- func (m *MapHashStorage) Delete(key []byte) (bool, error)
- func (m *MapHashStorage) Keys() ([][]byte, error)
- func (m *MapHashStorage) Lookup(key []byte) (uint64, error)
- func (m *MapHashStorage) Read() (<-chan []byte, error)
- func (m *MapHashStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
- func (m *MapHashStorage) Write(data []byte) error
- type MapIterator
- type MapLRUStorage
- func (m *MapLRUStorage) Delete(key []byte) (bool, error)
- func (m *MapLRUStorage) Keys() ([][]byte, error)
- func (m *MapLRUStorage) Lookup(key []byte) (uint64, error)
- func (m *MapLRUStorage) Read() (<-chan []byte, error)
- func (m *MapLRUStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
- func (m *MapLRUStorage) Write(data []byte) error
- type MapPerCPUArrayStorage
- func (m *MapPerCPUArrayStorage) Delete(key []byte) (bool, error)
- func (m *MapPerCPUArrayStorage) Keys() ([][]byte, error)
- func (m *MapPerCPUArrayStorage) Lookup(key []byte) (uint64, error)
- func (m *MapPerCPUArrayStorage) Read() (<-chan []byte, error)
- func (m *MapPerCPUArrayStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
- func (m *MapPerCPUArrayStorage) Write(data []byte) error
- type MapPerfStorage
- func (m *MapPerfStorage) Delete(key []byte) (bool, error)
- func (m *MapPerfStorage) Keys() ([][]byte, error)
- func (m *MapPerfStorage) Lookup(key []byte) (uint64, error)
- func (m *MapPerfStorage) Read() (<-chan []byte, error)
- func (m *MapPerfStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
- func (m *MapPerfStorage) Write(data []byte) error
- type MapProgArrayStorage
- func (m *MapProgArrayStorage) Delete(key []byte) (bool, error)
- func (m *MapProgArrayStorage) Keys() ([][]byte, error)
- func (m *MapProgArrayStorage) Lookup(key []byte) (uint64, error)
- func (m *MapProgArrayStorage) Read() (<-chan []byte, error)
- func (m *MapProgArrayStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
- func (m *MapProgArrayStorage) Write(data []byte) error
- type MapStorage
- func NewMapArrayStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
- func NewMapHashStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
- func NewMapLRUStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
- func NewMapPerCPUArrayStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
- func NewMapPerfStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
- func NewMapProgArrayStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
- type MapUpdateType
- type MemBlock
- type NullLogger
- func (l NullLogger) Debug(params ...interface{})
- func (l NullLogger) Debugf(format string, params ...interface{})
- func (l NullLogger) Error(params ...interface{})
- func (l NullLogger) Errorf(format string, params ...interface{})
- func (l NullLogger) Info(params ...interface{})
- func (l NullLogger) Infof(format string, params ...interface{})
- type Observer
- type Opts
- type Printk
- type Program
- type RawContext
- type Regs
- type StdContext
- type VM
- func (vm *VM) AddProgram(program *ebpf.ProgramSpec) uint32
- func (vm *VM) Heap() *Heap
- func (vm *VM) LoadMap(name string) error
- func (vm *VM) LoadMaps(section ...string) error
- func (vm *VM) LoadProgram(section string) (uint32, error)
- func (vm *VM) Map(name string) *Map
- func (vm *VM) RunInstructions(ctx Context, insts []asm.Instruction) (int, error)
- func (vm *VM) RunProgram(ctx Context, section string) (int, error)
- type VariableReader
Constants ¶
View Source
const ( // static void *(*baloum_malloc)(__u32 size) = (void *) 0xffff; FnMalloc = asm.BuiltinFunc(0xffff) // static int (*baloum_call)(struct baloum_ctx *ctx, const char *section) = (void *) 0xfffe; FnCall = asm.BuiltinFunc(0xfffe) // static int (*baloum_strcmp)(const char *s1, const char *s2) = (void *)0xfffd; FnStrCmp = asm.BuiltinFunc(0xfffd) // static int (*baloum_memcmp)(const void *b1, const void *b2, __u32 size) = (void *)0xfffc; FnMemCmp = asm.BuiltinFunc(0xfffc) // static int (*baloum_sleep)(__u64 ns) = (void *)0xfffb; FnSleep = asm.BuiltinFunc(0xfffb) )
View Source
const ( // HEAP_ADDR_MASK identifying heap address HEAP_ADDR_MASK uint64 = 0xff00000000000000 // ADDR_MASK ADDR_MASK uint64 = 0xffffffff // IDX_MASK IDX_MASK uint64 = 0xffff )
View Source
const ( REGS_NUM = 11 REGS_SIZE = REGS_NUM * 8 )
View Source
const (
CTX_SIZE = 5 * 8 // 5 argument
)
View Source
const (
DEFAULT_STACK_SIZE = 512
)
View Source
const (
ErrorCode = int(-1)
)
Variables ¶
View Source
var ByteOrder binary.ByteOrder
Functions ¶
func Bytes2String ¶
func FnCallImpl ¶
func FnCallImpl(vm *VM, inst *asm.Instruction) error
func FnGetCurrentPidTgidImpl ¶
func FnGetCurrentPidTgidImpl(vm *VM, inst *asm.Instruction) error
func FnGetSmpProcessorIdImpl ¶
func FnGetSmpProcessorIdImpl(vm *VM, inst *asm.Instruction) error
func FnKtimeGetNsImpl ¶
func FnKtimeGetNsImpl(vm *VM, inst *asm.Instruction) error
func FnMallocImpl ¶
func FnMallocImpl(vm *VM, inst *asm.Instruction) error
func FnMapDeleteElemImpl ¶
func FnMapDeleteElemImpl(vm *VM, inst *asm.Instruction) error
func FnMapLookupElemImpl ¶
func FnMapLookupElemImpl(vm *VM, inst *asm.Instruction) error
func FnMapUpdateElemImpl ¶
func FnMapUpdateElemImpl(vm *VM, inst *asm.Instruction) error
func FnMemCmpImpl ¶
func FnMemCmpImpl(vm *VM, inst *asm.Instruction) error
func FnPerfEventOutputImpl ¶
func FnPerfEventOutputImpl(vm *VM, inst *asm.Instruction) error
func FnProbeReadImpl ¶
func FnProbeReadImpl(vm *VM, inst *asm.Instruction) error
func FnProbeReadStrImpl ¶
func FnProbeReadStrImpl(vm *VM, inst *asm.Instruction) error
func FnSleepImpl ¶
func FnSleepImpl(vm *VM, inst *asm.Instruction) error
func FnStrCmpImpl ¶
func FnStrCmpImpl(vm *VM, inst *asm.Instruction) error
func FnTailCallImpl ¶
func FnTailCallImpl(vm *VM, inst *asm.Instruction) error
func FnTracePrintkImpl ¶
func FnTracePrintkImpl(vm *VM, inst *asm.Instruction) error
func GetHostByteOrder ¶
GetHostByteOrder guesses the hosts byte order
func Instructions ¶
func Instructions(insts ...interface{}) asm.Instructions
func ResolveReferences ¶
func ResolveReferences(insts asm.Instructions) error
func UnmarshalCtx ¶
Types ¶
type BTInst ¶
type BTInst struct { PC int Inst asm.Instruction }
type DebugCommand ¶
type DebugCommand string
const ( NextCommand DebugCommand = "n" ContinueCommand DebugCommand = "c" PrintStackCommand DebugCommand = "ps" PrintRegistersCommand DebugCommand = "pr" PrintVariableCommand DebugCommand = "pv" PrintMap DebugCommand = "pm" PrintCommand DebugCommand = "p" PrintBacktraceCommand DebugCommand = "bt" )
type Debugger ¶
type Debugger struct { Enabled bool VariableReader map[string]VariableReader // contains filtered or unexported fields }
func NewDebugger ¶
func NewDebugger(enabled bool, variableReaders map[string]VariableReader) *Debugger
func (*Debugger) ObserveInst ¶
func (d *Debugger) ObserveInst(vm *VM, pc int, inst *asm.Instruction)
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func (*Map) Iterator ¶
func (m *Map) Iterator() (*MapIterator, error)
func (*Map) LookupAddr ¶
type MapArrayStorage ¶
type MapArrayStorage struct {
// contains filtered or unexported fields
}
func (*MapArrayStorage) Keys ¶
func (m *MapArrayStorage) Keys() ([][]byte, error)
func (*MapArrayStorage) Read ¶
func (m *MapArrayStorage) Read() (<-chan []byte, error)
func (*MapArrayStorage) Update ¶
func (m *MapArrayStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
func (*MapArrayStorage) Write ¶
func (m *MapArrayStorage) Write(data []byte) error
type MapCollection ¶
type MapCollection struct {
// contains filtered or unexported fields
}
func NewMapCollection ¶
func NewMapCollection(vm *VM) *MapCollection
func (*MapCollection) GetMapById ¶
func (mc *MapCollection) GetMapById(id int) *Map
func (*MapCollection) GetMapByName ¶
func (mc *MapCollection) GetMapByName(name string) *Map
func (*MapCollection) LoadMap ¶
func (mc *MapCollection) LoadMap(spec *ebpf.CollectionSpec, name string) error
func (*MapCollection) LoadMaps ¶
func (mc *MapCollection) LoadMaps(spec *ebpf.CollectionSpec, sections ...string) error
type MapHashStorage ¶
type MapHashStorage struct {
// contains filtered or unexported fields
}
func (*MapHashStorage) Keys ¶
func (m *MapHashStorage) Keys() ([][]byte, error)
func (*MapHashStorage) Read ¶
func (m *MapHashStorage) Read() (<-chan []byte, error)
func (*MapHashStorage) Update ¶
func (m *MapHashStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
func (*MapHashStorage) Write ¶
func (m *MapHashStorage) Write(data []byte) error
type MapIterator ¶
type MapIterator struct {
// contains filtered or unexported fields
}
type MapLRUStorage ¶
type MapLRUStorage struct {
// contains filtered or unexported fields
}
func (*MapLRUStorage) Keys ¶
func (m *MapLRUStorage) Keys() ([][]byte, error)
func (*MapLRUStorage) Read ¶
func (m *MapLRUStorage) Read() (<-chan []byte, error)
func (*MapLRUStorage) Update ¶
func (m *MapLRUStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
func (*MapLRUStorage) Write ¶
func (m *MapLRUStorage) Write(data []byte) error
type MapPerCPUArrayStorage ¶
type MapPerCPUArrayStorage struct {
// contains filtered or unexported fields
}
func (*MapPerCPUArrayStorage) Delete ¶
func (m *MapPerCPUArrayStorage) Delete(key []byte) (bool, error)
func (*MapPerCPUArrayStorage) Keys ¶
func (m *MapPerCPUArrayStorage) Keys() ([][]byte, error)
func (*MapPerCPUArrayStorage) Lookup ¶
func (m *MapPerCPUArrayStorage) Lookup(key []byte) (uint64, error)
func (*MapPerCPUArrayStorage) Read ¶
func (m *MapPerCPUArrayStorage) Read() (<-chan []byte, error)
func (*MapPerCPUArrayStorage) Update ¶
func (m *MapPerCPUArrayStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
func (*MapPerCPUArrayStorage) Write ¶
func (m *MapPerCPUArrayStorage) Write(data []byte) error
type MapPerfStorage ¶
type MapPerfStorage struct {
// contains filtered or unexported fields
}
func (*MapPerfStorage) Keys ¶
func (m *MapPerfStorage) Keys() ([][]byte, error)
func (*MapPerfStorage) Read ¶
func (m *MapPerfStorage) Read() (<-chan []byte, error)
func (*MapPerfStorage) Update ¶
func (m *MapPerfStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
func (*MapPerfStorage) Write ¶
func (m *MapPerfStorage) Write(data []byte) error
type MapProgArrayStorage ¶
type MapProgArrayStorage struct {
// contains filtered or unexported fields
}
func (*MapProgArrayStorage) Keys ¶
func (m *MapProgArrayStorage) Keys() ([][]byte, error)
func (*MapProgArrayStorage) Lookup ¶
func (m *MapProgArrayStorage) Lookup(key []byte) (uint64, error)
func (*MapProgArrayStorage) Read ¶
func (m *MapProgArrayStorage) Read() (<-chan []byte, error)
func (*MapProgArrayStorage) Update ¶
func (m *MapProgArrayStorage) Update(key []byte, value []byte, kind MapUpdateType) (bool, error)
func (*MapProgArrayStorage) Write ¶
func (m *MapProgArrayStorage) Write(data []byte) error
type MapStorage ¶
type MapStorage interface { Lookup(key []byte) (uint64, error) Update(key []byte, value []byte, kind MapUpdateType) (bool, error) Delete(key []byte) (bool, error) Keys() ([][]byte, error) Read() (<-chan []byte, error) Write(data []byte) error }
func NewMapArrayStorage ¶
func NewMapArrayStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
func NewMapHashStorage ¶
func NewMapHashStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
func NewMapLRUStorage ¶
func NewMapLRUStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
func NewMapPerCPUArrayStorage ¶
func NewMapPerCPUArrayStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
func NewMapPerfStorage ¶
func NewMapPerfStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
func NewMapProgArrayStorage ¶
func NewMapProgArrayStorage(vm *VM, keySize, valueSize, maxEntries, flags uint32) (MapStorage, error)
type MapUpdateType ¶
type MapUpdateType int
const ( BPF_ANY MapUpdateType = iota BPF_NOEXIST BPF_EXIST BPF_F_LOCK )
type NullLogger ¶
type NullLogger struct{}
func (NullLogger) Debug ¶
func (l NullLogger) Debug(params ...interface{})
func (NullLogger) Debugf ¶
func (l NullLogger) Debugf(format string, params ...interface{})
func (NullLogger) Error ¶
func (l NullLogger) Error(params ...interface{})
func (NullLogger) Errorf ¶
func (l NullLogger) Errorf(format string, params ...interface{})
func (NullLogger) Info ¶
func (l NullLogger) Info(params ...interface{})
func (NullLogger) Infof ¶
func (l NullLogger) Infof(format string, params ...interface{})
type Printk ¶
type Printk struct {
// contains filtered or unexported fields
}
func (Printk) Call ¶
func (p Printk) Call() asm.Instructions
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
func (*Program) Instructions ¶
func (p *Program) Instructions() asm.Instructions
type RawContext ¶
type RawContext struct {
Regs Regs
}
func (*RawContext) SetRegs ¶
func (ctx *RawContext) SetRegs(vm *VM)
type StdContext ¶
struct baloum_ctx { u64 arg0; u64 arg1; u64 arg2; u64 arg3; u64 arg4; };
func (*StdContext) Bytes ¶
func (ctx *StdContext) Bytes() []byte
func (*StdContext) Parse ¶
func (ctx *StdContext) Parse(data []byte) error
func (*StdContext) SetRegs ¶
func (ctx *StdContext) SetRegs(vm *VM)
type VM ¶
type VM struct { Spec *ebpf.CollectionSpec Opts Opts // contains filtered or unexported fields }
func (*VM) AddProgram ¶
func (vm *VM) AddProgram(program *ebpf.ProgramSpec) uint32
func (*VM) RunInstructions ¶
type VariableReader ¶
Click to show internal directories.
Click to hide internal directories.