diff options
author | Florent Revest <revest@chromium.org> | 2021-02-10 12:14:03 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-02-12 02:44:41 +0100 |
commit | c5dbb89fc2ac013afe67b9e4fcb3743c02b567cd (patch) | |
tree | 717c986e70611b002a57850957d7132121c7ec9f /kernel/trace/bpf_trace.c | |
parent | bpf: Be less specific about socket cookies guarantees (diff) | |
download | linux-c5dbb89fc2ac013afe67b9e4fcb3743c02b567cd.tar.xz linux-c5dbb89fc2ac013afe67b9e4fcb3743c02b567cd.zip |
bpf: Expose bpf_get_socket_cookie to tracing programs
This needs a new helper that:
- can work in a sleepable context (using sock_gen_cookie)
- takes a struct sock pointer and checks that it's not NULL
Signed-off-by: Florent Revest <revest@chromium.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: KP Singh <kpsingh@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210210111406.785541-2-revest@chromium.org
Diffstat (limited to 'kernel/trace/bpf_trace.c')
-rw-r--r-- | kernel/trace/bpf_trace.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 6c0018abe68a..845b2168e006 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1760,6 +1760,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) return &bpf_sk_storage_delete_tracing_proto; case BPF_FUNC_sock_from_file: return &bpf_sock_from_file_proto; + case BPF_FUNC_get_socket_cookie: + return &bpf_get_socket_ptr_cookie_proto; #endif case BPF_FUNC_seq_printf: return prog->expected_attach_type == BPF_TRACE_ITER ? |