Skip to content

Commit fe33008

Browse files
DanielTimLeeAlexei Starovoitov
authored andcommitted
samples: bpf: fix syscall_tp due to unused syscall
Currently, open() is called from the user program and it calls the syscall 'sys_openat', not the 'sys_open'. This leads to an error of the program of user side, due to the fact that the counter maps are zero since no function such 'sys_open' is called. This commit adds the kernel bpf program which are attached to the tracepoint 'sys_enter_openat' and 'sys_enter_openat'. Fixes: 1da236b ("bpf: add a test case for syscalls/sys_{enter|exit}_* tracepoints") Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent bba1b2a commit fe33008

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

‎samples/bpf/syscall_tp_kern.c‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,27 @@ static __always_inline void count(void *map)
4747
SEC("tracepoint/syscalls/sys_enter_open")
4848
int trace_enter_open(struct syscalls_enter_open_args *ctx)
4949
{
50-
count((void *)&enter_open_map);
50+
count(&enter_open_map);
51+
return 0;
52+
}
53+
54+
SEC("tracepoint/syscalls/sys_enter_openat")
55+
int trace_enter_open_at(struct syscalls_enter_open_args *ctx)
56+
{
57+
count(&enter_open_map);
5158
return 0;
5259
}
5360

5461
SEC("tracepoint/syscalls/sys_exit_open")
5562
int trace_enter_exit(struct syscalls_exit_open_args *ctx)
5663
{
57-
count((void *)&exit_open_map);
64+
count(&exit_open_map);
65+
return 0;
66+
}
67+
68+
SEC("tracepoint/syscalls/sys_exit_openat")
69+
int trace_enter_exit_at(struct syscalls_exit_open_args *ctx)
70+
{
71+
count(&exit_open_map);
5872
return 0;
5973
}

0 commit comments

Comments
 (0)