Skip to content

Commit 69a1917

Browse files
dzagoruianakryiko
authored andcommitted
samples: bpf: Fix syscall_tp openat argument
This modification doesn't change behaviour of the syscall_tp But such code is often used as a reference so it should be correct anyway Signed-off-by: Denys Zagorui <dzagorui@cisco.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20231019113521.4103825-1-dzagorui@cisco.com
1 parent cf559a4 commit 69a1917

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

samples/bpf/syscall_tp_kern.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,31 @@
44
#include <uapi/linux/bpf.h>
55
#include <bpf/bpf_helpers.h>
66

7+
#if !defined(__aarch64__)
78
struct syscalls_enter_open_args {
89
unsigned long long unused;
910
long syscall_nr;
1011
long filename_ptr;
1112
long flags;
1213
long mode;
1314
};
15+
#endif
1416

1517
struct syscalls_exit_open_args {
1618
unsigned long long unused;
1719
long syscall_nr;
1820
long ret;
1921
};
2022

23+
struct syscalls_enter_open_at_args {
24+
unsigned long long unused;
25+
long syscall_nr;
26+
long long dfd;
27+
long filename_ptr;
28+
long flags;
29+
long mode;
30+
};
31+
2132
struct {
2233
__uint(type, BPF_MAP_TYPE_ARRAY);
2334
__type(key, u32);
@@ -54,14 +65,14 @@ int trace_enter_open(struct syscalls_enter_open_args *ctx)
5465
#endif
5566

5667
SEC("tracepoint/syscalls/sys_enter_openat")
57-
int trace_enter_open_at(struct syscalls_enter_open_args *ctx)
68+
int trace_enter_open_at(struct syscalls_enter_open_at_args *ctx)
5869
{
5970
count(&enter_open_map);
6071
return 0;
6172
}
6273

6374
SEC("tracepoint/syscalls/sys_enter_openat2")
64-
int trace_enter_open_at2(struct syscalls_enter_open_args *ctx)
75+
int trace_enter_open_at2(struct syscalls_enter_open_at_args *ctx)
6576
{
6677
count(&enter_open_map);
6778
return 0;

0 commit comments

Comments
 (0)