Skip to content

Commit

Permalink
tetragon: Remove install tail call machinery
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Olsa <[email protected]>
  • Loading branch information
olsajiri committed Aug 20, 2024
1 parent 620d9fe commit 2d3a4d0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
43 changes: 0 additions & 43 deletions pkg/sensors/program/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,44 +702,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.PinName, load.TcPrefix); err != nil {
return err
}
}

return nil
}

func doLoadProgram(
bpfDir string,
load *Program,
Expand Down Expand Up @@ -883,11 +845,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 {
if m, ok := coll.Maps[mapLoad.Name]; ok {
if err := mapLoad.Load(m, mapLoad.Index); err != nil {
Expand Down
10 changes: 0 additions & 10 deletions pkg/sensors/program/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ type Program struct {
// Type information used for CO-RE relocations.
KernelTypes *btf.Spec

// Tail call prefix/map
TcPrefix string
TcMap *Map

Link link.Link
Prog *ebpf.Program

Expand All @@ -147,12 +143,6 @@ func (p *Program) SetAttachData(d interface{}) *Program {
return p
}

func (p *Program) SetTailCall(prefix string, m *Map) *Program {
p.TcPrefix = prefix
p.TcMap = m
return p
}

func (p *Program) SetPolicy(policy string) *Program {
p.Policy = policy
return p
Expand Down

0 comments on commit 2d3a4d0

Please sign in to comment.