Skip to content

Commit

Permalink
Fix memfd execution detection
Browse files Browse the repository at this point in the history
There was bug, testing the parent of the executed file for the `memfd`
prefix, which of course is wrong. We now thest the correct file.
  • Loading branch information
patrickpichler committed Jul 1, 2024
1 parent 25a3e44 commit 8fb1216
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/ebpftracer/c/headers/common/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ statfunc bool get_exe_upper_layer(struct dentry *dentry, struct super_block *sb)

static __always_inline bool get_exe_from_memfd(struct file *file)
{
const unsigned char *name = BPF_CORE_READ(file, f_path.dentry, d_parent, d_name.name);
const unsigned char *name = BPF_CORE_READ(file, f_path.dentry, d_name.name);
if (!name) {
bpf_printk("get_exe_from_memfd(): failed to get name");
return false;
Expand Down
Binary file modified pkg/ebpftracer/tracer_arm64_bpfel.o
Binary file not shown.
4 changes: 2 additions & 2 deletions pkg/ebpftracer/tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ func TestTracer(t *testing.T) {

policy := &ebpftracer.Policy{
Events: []*ebpftracer.EventPolicy{
{ID: events.NetFlowBase},
// {ID: events.NetFlowBase},
//{ID: events.NetPacketTCPBase},
//{ID: events.SchedProcessExec},
{ID: events.SchedProcessExec},
//{ID: events.SecuritySocketConnect},
//{ID: events.SockSetState},
//{ID: events.NetPacketDNSBase},
Expand Down
Binary file modified pkg/ebpftracer/tracer_x86_bpfel.o
Binary file not shown.

0 comments on commit 8fb1216

Please sign in to comment.