Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tetragon: Skip loading of override prog for kprobe multi object #1273

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/sensors/program/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ func LSMAttach() AttachFunc {
}
}

func MultiKprobeOpen(load *Program) OpenFunc {
return func(coll *ebpf.CollectionSpec) error {
// Disable loading of override program if it's not needed
if !load.Override {
progOverrideSpec, ok := coll.Programs["generic_kprobe_override"]
if ok {
progOverrideSpec.Type = ebpf.UnspecifiedProgram
}
}
return nil
}
}

func MultiKprobeAttach(load *Program) AttachFunc {
return func(coll *ebpf.Collection, collSpec *ebpf.CollectionSpec,
prog *ebpf.Program, spec *ebpf.ProgramSpec) (unloader.Unloader, error) {
Expand Down Expand Up @@ -367,6 +380,7 @@ func LoadUprobeProgram(bpfDir, mapDir string, load *Program, verbose int) error
func LoadMultiKprobeProgram(bpfDir, mapDir string, load *Program, verbose int) error {
opts := &loadOpts{
attach: MultiKprobeAttach(load),
open: MultiKprobeOpen(load),
ci: &customInstall{fmt.Sprintf("%s-kp_calls", load.PinPath), "kprobe"},
}
return loadProgram(bpfDir, []string{mapDir}, load, opts, verbose)
Expand Down
Loading