Skip to content

Commit

Permalink
samples: bpf: Fix syscall_tp openat argument
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
dzagorui authored and anakryiko committed Oct 23, 2023
1 parent cf559a4 commit 69a1917
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions samples/bpf/syscall_tp_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,31 @@
#include <uapi/linux/bpf.h>
#include <bpf/bpf_helpers.h>

#if !defined(__aarch64__)
struct syscalls_enter_open_args {
unsigned long long unused;
long syscall_nr;
long filename_ptr;
long flags;
long mode;
};
#endif

struct syscalls_exit_open_args {
unsigned long long unused;
long syscall_nr;
long ret;
};

struct syscalls_enter_open_at_args {
unsigned long long unused;
long syscall_nr;
long long dfd;
long filename_ptr;
long flags;
long mode;
};

struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__type(key, u32);
Expand Down Expand Up @@ -54,14 +65,14 @@ int trace_enter_open(struct syscalls_enter_open_args *ctx)
#endif

SEC("tracepoint/syscalls/sys_enter_openat")
int trace_enter_open_at(struct syscalls_enter_open_args *ctx)
int trace_enter_open_at(struct syscalls_enter_open_at_args *ctx)
{
count(&enter_open_map);
return 0;
}

SEC("tracepoint/syscalls/sys_enter_openat2")
int trace_enter_open_at2(struct syscalls_enter_open_args *ctx)
int trace_enter_open_at2(struct syscalls_enter_open_at_args *ctx)
{
count(&enter_open_map);
return 0;
Expand Down

0 comments on commit 69a1917

Please sign in to comment.