Skip to content

Commit 36f4eb1

Browse files
fix(pipeline): add ebpf caps in stack addres query
1 parent dba1a42 commit 36f4eb1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pkg/ebpf/events_pipeline.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"unsafe"
1010

1111
"github.com/aquasecurity/tracee/pkg/bufferdecoder"
12+
"github.com/aquasecurity/tracee/pkg/capabilities"
1213
"github.com/aquasecurity/tracee/pkg/errfmt"
1314
"github.com/aquasecurity/tracee/pkg/events"
1415
"github.com/aquasecurity/tracee/pkg/logger"
@@ -637,7 +638,12 @@ func (t *Tracee) getStackAddresses(stackID uint32) []uint64 {
637638
// Lookup the StackID in the map
638639
// The ID could have aged out of the Map, as it only holds a finite number of
639640
// Stack IDs in it's Map
640-
stackBytes, err := t.StackAddressesMap.GetValue(unsafe.Pointer(&stackID))
641+
var stackBytes []byte
642+
var err error
643+
err = capabilities.GetInstance().EBPF(func() error {
644+
stackBytes, err = t.StackAddressesMap.GetValue(unsafe.Pointer(&stackID))
645+
return err
646+
})
641647
if err != nil {
642648
logger.Debugw("failed to get StackAddress", "error", err)
643649
return stackAddresses[0:0]
@@ -656,7 +662,12 @@ func (t *Tracee) getStackAddresses(stackID uint32) []uint64 {
656662

657663
// Attempt to remove the ID from the map so we don't fill it up
658664
// But if this fails continue on
659-
_ = t.StackAddressesMap.DeleteKey(unsafe.Pointer(&stackID))
665+
err = capabilities.GetInstance().EBPF(func() error {
666+
return t.StackAddressesMap.DeleteKey(unsafe.Pointer(&stackID))
667+
})
668+
if err != nil {
669+
logger.Debugw("failed to delete stack address from eBPF map", "error", err)
670+
}
660671

661672
return stackAddresses[0:stackCounter]
662673
}

0 commit comments

Comments
 (0)