Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0 Copyright Authors of Tetragon
Index ¶
- Variables
- func GetProgramInfo(l *Program) (program, label, prog string)
- func LoadKprobeProgram(bpfDir, mapDir string, load *Program, verbose int) error
- func LoadKprobeProgramAttachMany(bpfDir, mapDir string, load *Program, syms []string, verbose int) error
- func LoadLSMProgram(bpfDir, mapDir string, load *Program, verbose int) error
- func LoadMultiKprobeProgram(bpfDir, mapDir string, load *Program, verbose int) error
- func LoadOrCreatePinnedMap(pinPath string, mapSpec *ebpf.MapSpec) (*ebpf.Map, error)
- func LoadProgram(bpfDir string, mapDirs []string, load *Program, attach AttachFunc, verbose int) error
- func LoadRawTracepointProgram(bpfDir, mapDir string, load *Program, verbose int) error
- func LoadTracepointProgram(bpfDir, mapDir string, load *Program, verbose int) error
- func LoadTracingProgram(bpfDir, mapDir string, load *Program, verbose int) error
- func LoadUprobeProgram(bpfDir, mapDir string, load *Program, verbose int) error
- type AttachFunc
- func KprobeAttach(load *Program, bpfDir string) AttachFunc
- func KprobeAttachMany(load *Program, syms []string) AttachFunc
- func LSMAttach() AttachFunc
- func MultiKprobeAttach(load *Program, bpfDir string) 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) AttachFunc
- func TracingAttach() AttachFunc
- func UprobeAttach(load *Program) AttachFunc
- type LoadedCollection
- type LoadedMap
- type LoadedProgram
- type Map
- func (m *Map) Close() error
- func (m *Map) GetFD() (int, error)
- 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 MultiKprobeAttachData
- type OpenFunc
- type Program
- type State
- type UprobeAttachData
Constants ¶
This section is empty.
Variables ¶
View Source
var (
KeepCollection bool
)
Functions ¶
func GetProgramInfo ¶
func LoadKprobeProgram ¶
func LoadKprobeProgramAttachMany ¶ added in v1.0.0
func LoadLSMProgram ¶ added in v0.10.0
func LoadMultiKprobeProgram ¶ added in v0.8.3
func LoadOrCreatePinnedMap ¶ added in v0.9.0
func LoadProgram ¶
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) 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 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) AttachFunc
func TracingAttach ¶ added in v0.10.0
func TracingAttach() AttachFunc
func UprobeAttach ¶ added in v0.9.0
func UprobeAttach(load *Program) AttachFunc
type LoadedCollection ¶
type LoadedCollection struct {
Programs map[string]*LoadedProgram
Maps map[string]*LoadedMap
}
type LoadedProgram ¶
type Map ¶
Map represents BPF maps.
func MapBuilder ¶
func MapBuilderPin ¶
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 MultiKprobeAttachData ¶ added in v0.9.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
// 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]string
// available when program.KeepCollection is true
LC *LoadedCollection
MaxEntriesMap map[string]uint32
MaxEntriesInnerMap map[string]uint32
// contains filtered or unexported fields
}
Program reprents a BPF program.
func (*Program) SetAttachData ¶ added in v0.9.0
func (*Program) SetLoaderData ¶
func (*Program) SetRetProbe ¶
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.