bpf: make bpf_session_cookie() reference optional
PATCH 1/1 bpf: make bpf_session_cookie() reference optional
From: Arnd Bergmann <[email protected]>
Building without CONFIG_BPF_EVENTS produces a build-time warning:
WARN: resolve_btfids: unresolved symbol bpf_session_is_return
The function is actually defined in kernel/trace/bpf_trace.o, which is built conditionally based on configuration.
Make the reference to this function conditional as well, as is already done in the bpf verifier for other functions.
--- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/verifier.c +4 -0
@@ -10882,7 +10882,11 @@ BTF_ID(func, bpf_task_work_schedule_resume) BTF_ID(func, bpf_arena_alloc_pages) BTF_ID(func, bpf_arena_free_pages) BTF_ID(func, bpf_arena_reserve_pages) +#ifdef CONFIG_BPF_EVENTS BTF_ID(func, bpf_session_is_return) +#else +BTF_ID_UNUSED +#endif BTF_ID(func, bpf_stream_vprintk) BTF_ID(func, bpf_stream_print_stack)
Signature · 1 line
2.39.5
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The commit title incorrectly states 'bpf: make bpf_session_cookie() reference optional', while the…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The commit title incorrectly states 'bpf: make bpf_session_cookie() reference optional', while the patch actually makes the bpf_session_is_return() reference optional. --
commit 955fac0158a2cad097b15c2d40f2d73bdbbf8828
Author: Arnd Bergmann <[email protected]>
bpf: make bpf_session_cookie() reference optional
This commit fixes a build warning caused by an unresolved btfid symbol when building without CONFIG_BPF_EVENTS. It wraps the function reference in the appropriate preprocessor conditionals to match the verifier's behavior for other conditionally built functions.
Quoted 1 line
bpf: make
bpf_session_cookie()reference optional
This isn't a bug, but the commit subject mentions bpf_session_cookie(), while the patch and the commit message body actually update the reference for bpf_session_is_return(). Should the subject be updated to match the function being modified?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewThe commit subject references bpf_session_cookie(), but the patch actually makes bpf_session_is_return() conditional. Should the subject line be updated to reflect the correct function name?
Quoted 5 lines
commit
2cc68d16a6fde2cca5c308c947ae835c366fe09cAuthor: Arnd Bergmann <[email protected]> Date: Fri May 15 11:06:15 2026 +0200bpf: make
bpf_session_cookie()reference optional
The commit subject references bpf_session_cookie(), but the patch actually makes bpf_session_is_return() conditional. Should the subject line be updated to reflect the correct function name?
Reference: https://lore.kernel.org/bpf/[email protected]/
Quoted 20 lines
Building without
CONFIG_BPF_EVENTSproduces a build-time warning:WARN:
resolve_btfids: unresolved symbolbpf_session_is_returnThe function is actually defined in
kernel/trace/bpf_trace.o, which is built conditionally based on configuration.Make the reference to this function conditional as well, as is already done in the bpf verifier for other functions.
Fixes 8fe4dc4f6456 ("bpf: change prototype of bpf_session_{cookie,is_return}")Signed-off-by Arnd Bergmann <[email protected]>kernel/bpf/verifier.c +0
-0
kernel/bpf/verifier.c BTF_ID(func, bpf_task_work_schedule_resume) · line 11097
Quoted 10 lines
kernel/bpf/verifier.c +4
-0@@ -11088,7 +11088,11 @@ BTF_ID(func, bpf_task_work_schedule_resume) BTF_ID(func, bpf_arena_alloc_pages) BTF_ID(func, bpf_arena_free_pages) BTF_ID(func, bpf_arena_reserve_pages) +#ifdef CONFIG_BPF_EVENTS BTF_ID(func, bpf_session_is_return) +#else +BTF_ID_UNUSED +#endif BTF_ID(func, bpf_stream_vprintk) BTF_ID(func, bpf_stream_print_stack)
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/25910298674
Quoted 7 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building without
CONFIG_BPF_EVENTSproduces a build-time warning:WARN:
resolve_btfids: unresolved symbolbpf_session_is_return
Quoted 8 lines
The function is actually defined in
kernel/trace/bpf_trace.o, which is built conditionally based on configuration.Make the reference to this function conditional as well, as is already done in the bpf verifier for other functions.
Fixes 8fe4dc4f6456 ("bpf: change prototype of bpf_session_{cookie,is_return}")Signed-off-by Arnd Bergmann <[email protected]>
LGTM exception in subject bpf_session_cookie() should be bpf_session_is_return().