Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: Change bpf_session_cookie return value to __u64 *

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

authored by

Jiri Olsa and committed by
Daniel Borkmann
717d6313 1ae7a19e

+3 -3
+1 -1
kernel/trace/bpf_trace.c
··· 3530 3530 return session_ctx->is_return; 3531 3531 } 3532 3532 3533 - __bpf_kfunc long *bpf_session_cookie(void) 3533 + __bpf_kfunc __u64 *bpf_session_cookie(void) 3534 3534 { 3535 3535 struct bpf_session_run_ctx *session_ctx; 3536 3536
+1 -1
tools/testing/selftests/bpf/bpf_kfuncs.h
··· 77 77 struct bpf_key *trusted_keyring) __ksym; 78 78 79 79 extern bool bpf_session_is_return(void) __ksym __weak; 80 - extern long *bpf_session_cookie(void) __ksym __weak; 80 + extern __u64 *bpf_session_cookie(void) __ksym __weak; 81 81 #endif
+1 -1
tools/testing/selftests/bpf/progs/kprobe_multi_session_cookie.c
··· 25 25 26 26 static int check_cookie(__u64 val, __u64 *result) 27 27 { 28 - long *cookie; 28 + __u64 *cookie; 29 29 30 30 if (bpf_get_current_pid_tgid() >> 32 != pid) 31 31 return 1;