aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/bpf_trace.c
diff options
context:
space:
mode:
authorHengqi Chen <hengqi.chen@gmail.com>2021-10-21 21:47:51 +0800
committerAlexei Starovoitov <ast@kernel.org>2021-10-21 15:11:06 -0700
commit9eeb3aa33ae005526f672b394c1791578463513f (patch)
tree0c70fe4027644192a334d3bd60bbbcb8e4f7758d /kernel/trace/bpf_trace.c
parentsamples: bpf: Suppress readelf stderr when probing for BTF support (diff)
downloadlinux-dev-9eeb3aa33ae005526f672b394c1791578463513f.tar.xz
linux-dev-9eeb3aa33ae005526f672b394c1791578463513f.zip
bpf: Add bpf_skc_to_unix_sock() helper
The helper is used in tracing programs to cast a socket pointer to a unix_sock pointer. The return value could be NULL if the casting is illegal. Suggested-by: Yonghong Song <yhs@fb.com> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20211021134752.1223426-2-hengqi.chen@gmail.com
Diffstat (limited to 'kernel/trace/bpf_trace.c')
-rw-r--r--kernel/trace/bpf_trace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 6b3153841a33..cbcd0d6fca7c 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1608,6 +1608,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_skc_to_tcp_request_sock_proto;
case BPF_FUNC_skc_to_udp6_sock:
return &bpf_skc_to_udp6_sock_proto;
+ case BPF_FUNC_skc_to_unix_sock:
+ return &bpf_skc_to_unix_sock_proto;
case BPF_FUNC_sk_storage_get:
return &bpf_sk_storage_get_tracing_proto;
case BPF_FUNC_sk_storage_delete: