Skip to content
Merged
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
22 changes: 3 additions & 19 deletions pkg/ebpf/tracee.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,27 +686,11 @@ func (t *Tracee) initTailCall(tailCall events.TailCall) error {
return errfmt.Errorf("could not get BPF program FD for %s: %v", tailCallProgName, err)
}

once := &sync.Once{}

// Pick all indexes (event, or syscall, IDs) the BPF program should be related to.
for _, index := range tailCallIndexes {
// Special treatment for indexes of syscall events.
if events.Core.GetDefinitionByID(events.ID(index)).IsSyscall() {
// Optimization: enable enter/exit probes only if at least one syscall is enabled.
once.Do(func() {
err := t.probes.Attach(probes.SyscallEnter__Internal, t.kernelSymbols)
if err != nil {
logger.Errorw("error attaching to syscall enter", "error", err)
}
err = t.probes.Attach(probes.SyscallExit__Internal, t.kernelSymbols)
if err != nil {
logger.Errorw("error attaching to syscall enter", "error", err)
}
})
// Workaround: Do not map eBPF program to unsupported syscalls (arm64, e.g.)
if index >= uint32(events.Unsupported) {
continue
}
// Workaround: Do not map eBPF program to unsupported syscalls (arm64, e.g.)
if index >= uint32(events.Unsupported) {
continue
}
// Update given eBPF map with the eBPF program file descriptor at given index.
err := bpfMap.Update(unsafe.Pointer(&index), unsafe.Pointer(&bpfProgFD))
Expand Down