Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FUNC_RET_READ for inet_csk_accept #201

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GPL/Events/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const volatile int consumer_pid = 0;
ret; \
})

// value is replaced later by `probe_fill_relos()`
#define DECL_FUNC_RET(func) const volatile int ret__##func##__ = 0;
#define FUNC_RET_READ(type, func) \
({ \
Expand Down
6 changes: 4 additions & 2 deletions GPL/Events/Network/Probe.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "Network.h"
#include "State.h"

DECL_FUNC_RET(inet_csk_accept);

static int inet_csk_accept__exit(struct sock *sk)
{
if (!sk)
Expand All @@ -42,9 +44,9 @@ static int inet_csk_accept__exit(struct sock *sk)
}

SEC("fexit/inet_csk_accept")
int BPF_PROG(
fexit__inet_csk_accept, struct sock *sk, int flags, int *err, bool kern, struct sock *ret)
int BPF_PROG(fexit__inet_csk_accept)
{
struct sock *ret = FUNC_RET_READ(___type(ret), inet_csk_accept);
return inet_csk_accept__exit(ret);
}

Expand Down
2 changes: 2 additions & 0 deletions non-GPL/Events/Lib/EbpfEvents.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ static int probe_fill_relos(struct btf *btf, struct EventProbe_bpf *obj)
{
int err = 0;

err = err ?: FILL_FUNC_RET_IDX(obj, btf, inet_csk_accept);

err = err ?: FILL_FUNC_ARG_IDX(obj, btf, vfs_unlink, dentry);
err = err ?: FILL_FUNC_RET_IDX(obj, btf, vfs_unlink);

Expand Down
Loading