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

refactor: remove deprecated installTailCalls function and its usage #3258

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
43 changes: 0 additions & 43 deletions pkg/sensors/program/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,44 +692,6 @@ func slimVerifierError(errStr string) string {
return errStr[:headEnd] + "\n...\n" + errStr[tailStart:]
}

func installTailCalls(bpfDir string, spec *ebpf.CollectionSpec, coll *ebpf.Collection, load *Program) error {
// FIXME(JM): This should be replaced by using the cilium/ebpf prog array initialization.

secToProgName := make(map[string]string)
for name, prog := range spec.Programs {
secToProgName[prog.SectionName] = name
}

install := func(pinPath string, secPrefix string) error {
tailCallsMap, err := ebpf.LoadPinnedMap(filepath.Join(bpfDir, pinPath), nil)
if err != nil {
return nil
}
defer tailCallsMap.Close()

for i := 0; i < 13; i++ {
secName := fmt.Sprintf("%s/%d", secPrefix, i)
if progName, ok := secToProgName[secName]; ok {
if prog, ok := coll.Programs[progName]; ok {
err := tailCallsMap.Update(uint32(i), uint32(prog.FD()), ebpf.UpdateAny)
if err != nil {
return fmt.Errorf("update of tail-call map '%s' failed: %w", pinPath, err)
}
}
}
}
return nil
}

if load.TcMap != nil {
if err := install(load.TcMap.PinPath, load.TcPrefix); err != nil {
return err
}
}

return nil
}

// MissingConstantsError is returned by [rewriteConstants].
type MissingConstantsError struct {
// The constants missing from .rodata.
Expand Down Expand Up @@ -938,11 +900,6 @@ func doLoadProgram(
}
}

err = installTailCalls(bpfDir, spec, coll, load)
if err != nil {
return nil, fmt.Errorf("installing tail calls failed: %s", err)
}

for _, mapLoad := range load.MapLoad {
pinPath := ""
if pm, ok := load.PinMap[mapLoad.Name]; ok {
Expand Down
Loading