Documentation ¶
Index ¶
- Variables
- func GetProgramInfo(l *Program) (program, label, prog string)
- func LoadFmodRetProgram(bpfDir string, load *Program, progName string, verbose int) error
- func LoadKprobeProgram(bpfDir string, load *Program, verbose int) error
- func LoadKprobeProgramAttachMany(bpfDir string, load *Program, syms []string, verbose int) error
- func LoadLSMProgram(bpfDir string, load *Program, verbose int) error
- func LoadLSMProgramSimple(bpfDir string, load *Program, verbose int) error
- func LoadMultiKprobeProgram(bpfDir string, load *Program, verbose int) error
- func LoadMultiUprobeProgram(bpfDir string, load *Program, verbose int) error
- func LoadOrCreatePinnedMap(pinPath string, mapSpec *ebpf.MapSpec) (*ebpf.Map, error)
- func LoadProgram(bpfDir string, load *Program, attach AttachFunc, verbose int) error
- func LoadProgramOpts(bpfDir string, load *Program, opts *LoadOpts, verbose int) error
- func LoadRawTracepointProgram(bpfDir string, load *Program, verbose int) error
- func LoadTracepointProgram(bpfDir string, load *Program, verbose int) error
- func LoadTracingProgram(bpfDir string, load *Program, verbose int) error
- func LoadUprobeProgram(bpfDir string, load *Program, verbose int) error
- type AttachFunc
- func KprobeAttach(load *Program, bpfDir string) AttachFunc
- func KprobeAttachMany(load *Program, syms []string, bpfDir string) AttachFunc
- func LSMAttach() AttachFunc
- func MultiKprobeAttach(load *Program, bpfDir string) AttachFunc
- func MultiUprobeAttach(load *Program) AttachFunc
- func NoAttach() AttachFunc
- func RawAttach(targetFD int) AttachFunc
- func RawAttachWithFlags(targetFD int, flags uint32) AttachFunc
- func RawTracepointAttach(load *Program) AttachFunc
- func TracepointAttach(load *Program, bpfDir string) AttachFunc
- func TracingAttach() AttachFunc
- func UprobeAttach(load *Program) AttachFunc
- type LoadOpts
- type LoadedCollection
- type LoadedMap
- type LoadedProgram
- type Map
- func (m *Map) Close() error
- func (m *Map) GetFD() (int, error)
- func (m *Map) GetMaxEntries() (uint32, bool)
- func (m *Map) GetMaxInnerEntries() (uint32, bool)
- func (m *Map) IsCompatibleWith(spec *ebpf.MapSpec) error
- func (m *Map) LoadOrCreatePinnedMap(pinPath string, mapSpec *ebpf.MapSpec) error
- func (m *Map) LoadPinnedMap(path string) error
- func (m *Map) New(spec *ebpf.MapSpec) error
- func (m *Map) Pin(path string) error
- func (m *Map) SetInnerMaxEntries(max int)
- func (m *Map) SetMaxEntries(max int)
- func (m *Map) Unload() error
- type MapLoad
- type MaxEntries
- type MultiKprobeAttachData
- type MultiUprobeAttachData
- type MultiUprobeAttachSymbolsCookies
- type OpenFunc
- type Program
- func (p *Program) Relink() error
- func (p *Program) SetAttachData(d interface{}) *Program
- func (p *Program) SetLoaderData(d interface{}) *Program
- func (p *Program) SetPolicy(policy string) *Program
- func (p *Program) SetRetProbe(ret bool) *Program
- func (p *Program) SetTailCall(prefix string, m *Map) *Program
- func (p *Program) Unlink() error
- func (p *Program) Unload() error
- type State
- type UprobeAttachData
Constants ¶
This section is empty.
Variables ¶
View Source
var (
KeepCollection bool
)
Functions ¶
func GetProgramInfo ¶
func LoadFmodRetProgram ¶ added in v1.1.0
func LoadKprobeProgramAttachMany ¶ added in v1.0.0
func LoadLSMProgram ¶ added in v0.10.0
func LoadLSMProgramSimple ¶ added in v1.2.0
func LoadMultiKprobeProgram ¶ added in v0.8.3
func LoadMultiUprobeProgram ¶ added in v1.1.0
func LoadOrCreatePinnedMap ¶ added in v0.9.0
func LoadProgram ¶
func LoadProgram( bpfDir string, load *Program, attach AttachFunc, verbose int, ) error
func LoadProgramOpts ¶ added in v1.2.0
func LoadTracepointProgram ¶
func LoadTracingProgram ¶ added in v0.10.0
Types ¶
type AttachFunc ¶
type AttachFunc func(*ebpf.Collection, *ebpf.CollectionSpec, *ebpf.Program, *ebpf.ProgramSpec) (unloader.Unloader, error)
AttachFunc is the type for the various attachment functions. The function is given the program and it's up to it to close it.
func KprobeAttach ¶
func KprobeAttach(load *Program, bpfDir string) AttachFunc
func KprobeAttachMany ¶ added in v1.0.0
func KprobeAttachMany(load *Program, syms []string, bpfDir string) AttachFunc
func LSMAttach ¶ added in v0.10.0
func LSMAttach() AttachFunc
func MultiKprobeAttach ¶ added in v0.8.3
func MultiKprobeAttach(load *Program, bpfDir string) AttachFunc
func MultiUprobeAttach ¶ added in v1.1.0
func MultiUprobeAttach(load *Program) AttachFunc
func NoAttach ¶
func NoAttach() AttachFunc
func RawAttach ¶
func RawAttach(targetFD int) AttachFunc
func RawAttachWithFlags ¶ added in v0.10.0
func RawAttachWithFlags(targetFD int, flags uint32) AttachFunc
func RawTracepointAttach ¶
func RawTracepointAttach(load *Program) AttachFunc
func TracepointAttach ¶
func TracepointAttach(load *Program, bpfDir string) AttachFunc
func TracingAttach ¶ added in v0.10.0
func TracingAttach() AttachFunc
func UprobeAttach ¶ added in v0.9.0
func UprobeAttach(load *Program) AttachFunc
type LoadOpts ¶ added in v1.2.0
type LoadOpts struct { Attach AttachFunc Open OpenFunc }
type LoadedCollection ¶
type LoadedCollection struct { Programs map[string]*LoadedProgram Maps map[string]*LoadedMap }
type LoadedProgram ¶
type Map ¶
type Map struct { Name string PinName string Prog *Program PinState State MapHandle *ebpf.Map Entries MaxEntries InnerEntries MaxEntries }
Map represents BPF maps.
func MapBuilder ¶
func MapBuilderPin ¶
func (*Map) GetMaxEntries ¶ added in v1.2.0
func (*Map) GetMaxInnerEntries ¶ added in v1.2.0
func (*Map) IsCompatibleWith ¶ added in v0.9.0
func (*Map) LoadOrCreatePinnedMap ¶ added in v0.9.0
func (*Map) LoadPinnedMap ¶
func (*Map) SetInnerMaxEntries ¶ added in v0.11.0
func (*Map) SetMaxEntries ¶ added in v0.9.0
type MaxEntries ¶ added in v1.2.0
type MultiKprobeAttachData ¶ added in v0.9.0
type MultiUprobeAttachData ¶ added in v1.1.0
type MultiUprobeAttachData struct { // Path -> []{Symbol,Cookie} Attach map[string]*MultiUprobeAttachSymbolsCookies }
type MultiUprobeAttachSymbolsCookies ¶ added in v1.1.0
type OpenFunc ¶ added in v0.11.0
type OpenFunc func(*ebpf.CollectionSpec) error
func KprobeOpen ¶ added in v0.11.0
type Program ¶
type Program struct { // Name is the name of the BPF object file. Name string // Attach is the attachment point, e.g. the kernel function. Attach string // Label is the program section name to load from program. Label string // PinPath is the pinned path to this program. Note this is a relative path // based on the BPF directory FGS is running under. PinPath string // RetProbe indicates whether a kprobe is a kretprobe. RetProbe bool // ErrorFatal indicates whether a program must load and fatal otherwise. // Most program will set this to true. For example, kernel functions hooks // may change across verions so different names are attempted, hence // avoiding fataling when the first attempt fails. ErrorFatal bool // Needs override bpf program Override bool OverrideFmodRet bool // Needs attached link to be pinned PinLink bool // Type is the type of BPF program. For example, tc, skb, tracepoint, // etc. Type string LoadState State // LoaderData represents per-type specific fields. LoaderData interface{} // AttachData represents specific data for attaching probe AttachData interface{} MapLoad []*MapLoad PinMap map[string]*Map // available when program.KeepCollection is true LC *LoadedCollection RewriteConstants map[string]interface{} // Type information used for CO-RE relocations. KernelTypes *btf.Spec // Tail call prefix/map TcPrefix string TcMap *Map Link link.Link Prog *ebpf.Program // policy name the program belongs to Policy string // contains filtered or unexported fields }
Program reprents a BPF program.
func (*Program) SetAttachData ¶ added in v0.9.0
func (*Program) SetLoaderData ¶
func (*Program) SetRetProbe ¶
func (*Program) SetTailCall ¶ added in v1.2.0
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents the state of a BPF program or map.
NB: Currently there is no case where we attempt to load a program that is already loaded. If this changes, we can use the count as a reference count to track users of a bpf program.
type UprobeAttachData ¶ added in v0.9.0
Click to show internal directories.
Click to hide internal directories.