]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bpf: Change bpf_session_cookie return value to __u64 *
authorJiri Olsa <jolsa@kernel.org>
Wed, 19 Jun 2024 08:16:24 +0000 (10:16 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 21 Jun 2024 17:32:36 +0000 (19:32 +0200)
This reverts [1] and changes return value for bpf_session_cookie
in bpf selftests. Having long * might lead to problems on 32-bit
architectures.

Fixes: 2b8dd87332cd ("bpf: Make bpf_session_cookie() kfunc return long *")
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240619081624.1620152-1-jolsa@kernel.org
kernel/trace/bpf_trace.c
tools/testing/selftests/bpf/bpf_kfuncs.h
tools/testing/selftests/bpf/progs/kprobe_multi_session_cookie.c

index 4b3fda4562999bbbc01f7432aac8d6ed1e2fc1c4..cd098846e251cdaabc3f2b16242760fe26606273 100644 (file)
@@ -3530,7 +3530,7 @@ __bpf_kfunc bool bpf_session_is_return(void)
        return session_ctx->is_return;
 }
 
-__bpf_kfunc long *bpf_session_cookie(void)
+__bpf_kfunc __u64 *bpf_session_cookie(void)
 {
        struct bpf_session_run_ctx *session_ctx;
 
index be91a6919315888de35665d71affcdcc54d52aed..3b6675ab40861037a031e2f22c671d5098c68936 100644 (file)
@@ -77,5 +77,5 @@ extern int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_ptr,
                                      struct bpf_key *trusted_keyring) __ksym;
 
 extern bool bpf_session_is_return(void) __ksym __weak;
-extern long *bpf_session_cookie(void) __ksym __weak;
+extern __u64 *bpf_session_cookie(void) __ksym __weak;
 #endif
index d49070803e2216f2109901d22c3c19a4e893a148..0835b5edf6858a454274e7242829c36aa2904095 100644 (file)
@@ -25,7 +25,7 @@ int BPF_PROG(trigger)
 
 static int check_cookie(__u64 val, __u64 *result)
 {
-       long *cookie;
+       __u64 *cookie;
 
        if (bpf_get_current_pid_tgid() >> 32 != pid)
                return 1;