bpf: fix perf_snapshot_branch_stack link failure
PATCH 1/1 bpf: fix perf_snapshot_branch_stack link failure
From: Arnd Bergmann <[email protected]>
The newly added code to handle bpf_get_branch_snapshot fails to link when CONFIG_PERF_EVENTS is disabled:
aarch64-linux-ld: kernel/bpf/verifier.o: in function `do_misc_fixups':
verifier.c:(.text+0x1090c): undefined reference to `__SCK__perf_snapshot_branch_stack'
Add a build-time check for that Kconfig symbol around the code to remove the link time dependency.
--- kernel/bpf/verifier.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/bpf/verifier.c +2 -1
@@ -20192,7 +20192,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env) }/* Implement bpf_get_branch_snapshot inline. */ -if (prog->jit_requested &&BITS_PER_LONG ==64 && +if (IS_ENABLED (CONFIG_PERF_EVENTS ) && + prog->jit_requested &&BITS_PER_LONG ==64 && insn->imm == BPF_FUNC_get_branch_snapshot) {/* We are dealing with the following func protos: * u64 bpf_get_branch_snapshot(void *buf, u32 size, u64 flags);
Signature · 1 line
2.39.2
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · On Fri, 5 Apr 2024 16:26:25 +0200 you wrote:
From: Arnd Bergmann <[email protected]>
The newly added code to handle
bpf_get_branch_snapshotfails to link whenCONFIG_PERF_EVENTSis disabled:aarch64-linux-ld:
kernel/bpf/verifier.o: in function `do_misc_fixups':
verifier.c:(.text+0x1090c): undefined reference to `__SCK__perf_snapshot_branch_stack'[...]
Here is the summary with links:
- bpf: fix perf_snapshot_branch_stack link failure
https://git.kernel.org/bpf/bpf-next/c/58babe27180c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html