bpf: fix warning for bpf_cpumask in verifier
PATCH 1/1 bpf: fix warning for bpf_cpumask in verifier
Compiling with CONFIG_BPF_SYSCALL & !CONFIG_BPF_JIT throws the below warning:
"WARN: resolve_btfids: unresolved symbol bpf_cpumask"
Fix it by adding the appropriate #ifdef.
--- kernel/bpf/verifier.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/bpf/verifier.c +2 -0
@@ -5227,7 +5227,9 @@ BTF_ID(struct, prog_test_ref_kfunc)#ifdef CONFIG_CGROUPS BTF_ID(struct, cgroup)#endif +#ifdef CONFIG_BPF_JIT BTF_ID(struct, bpf_cpumask) +#endif BTF_ID(struct, task_struct)BTF_SET_END (rcu_protected_types)
Signature · 1 line
2.43.0
Quoted 6 lines · Hari Bathini
Compiling with
CONFIG_BPF_SYSCALL& !CONFIG_BPF_JIT throws the below warning:"WARN:
resolve_btfids: unresolved symbolbpf_cpumask"Fix it by adding the appropriate #ifdef.
Can you explain a bit more on why CONFIG_BPF_JIT is appropriate here? kernel/bpf/cpumask.c seems to be gated by CONFIG_BPF_SYSCALL.
So presumably all those symbols should be still compiled in with !CONFIG_BPF_JIT?
Quoted 11 lines · Stanislav Fomichev
Quoted 6 lines · Hari Bathini
Compiling with
CONFIG_BPF_SYSCALL& !CONFIG_BPF_JIT throws the below warning:"WARN:
resolve_btfids: unresolved symbolbpf_cpumask"Fix it by adding the appropriate #ifdef.
Can you explain a bit more on why
CONFIG_BPF_JITis appropriate here?kernel/bpf/cpumask.cseems to be gated byCONFIG_BPF_SYSCALL.
So presumably all those symbols should be still compiled in with !CONFIG_BPF_JIT?
Actually, CONFIG_BPF_JIT is the precondition for cpumask.c where bpf_cpumask structure is defined.
ifeq ($(CONFIG_BPF_JIT),y)
obj-$(CONFIG_BPF_SYSCALL) += bpf_struct_ops.o
obj-$(CONFIG_BPF_SYSCALL) += cpumask.o
obj-${CONFIG_BPF_LSM} += bpf_lsm.o
endifThanks
Hari
Stanislav Fomichev
Acked-byQuoted 16 lines · Hari Bathini
Quoted 11 lines · Stanislav Fomichev
Quoted 6 lines · Hari Bathini
Compiling with
CONFIG_BPF_SYSCALL& !CONFIG_BPF_JIT throws the below warning:"WARN:
resolve_btfids: unresolved symbolbpf_cpumask"Fix it by adding the appropriate #ifdef.
Can you explain a bit more on why
CONFIG_BPF_JITis appropriate here?kernel/bpf/cpumask.cseems to be gated byCONFIG_BPF_SYSCALL.
So presumably all those symbols should be still compiled in with !CONFIG_BPF_JIT?
Quoted 8 lines
Actually,
CONFIG_BPF_JITis the precondition forcpumask.cwherebpf_cpumaskstructure is defined.ifeq ($(CONFIG_BPF_JIT),y) obj-$(CONFIG_BPF_SYSCALL) += bpf_struct_ops.o obj-$(CONFIG_BPF_SYSCALL) += cpumask.o obj-${CONFIG_BPF_LSM} += bpf_lsm.o endif
Ah, good point!
Quoted 8 lines · Hari Bathini
Compiling with
CONFIG_BPF_SYSCALL& !CONFIG_BPF_JIT throws the below warning:"WARN:
resolve_btfids: unresolved symbolbpf_cpumask"Fix it by adding the appropriate #ifdef.
Signed-off-by Hari Bathini <[email protected]>
jirka
Quoted 22 lines
--- kernel/bpf/verifier.c | 2 ++ 1 file changed, 2 insertions(+)kernel/bpf/verifier.c +2
-0@@ -5227,7 +5227,9 @@ BTF_ID(struct, prog_test_ref_kfunc)#ifdef CONFIG_CGROUPS BTF_ID(struct, cgroup)#endif +#ifdef CONFIG_BPF_JIT BTF_ID(struct, bpf_cpumask) +#endif BTF_ID(struct, task_struct)BTF_SET_END (rcu_protected_types)Signature · 1 line
2.43.0
Quoted 6 lines · Hari Bathini
Compiling with
CONFIG_BPF_SYSCALL& !CONFIG_BPF_JIT throws the below warning:"WARN:
resolve_btfids: unresolved symbolbpf_cpumask"Fix it by adding the appropriate #ifdef.
Thanks for the fix!
Quoted 1 line
Signed-off-by Hari Bathini <[email protected]>
This patch was applied to bpf/bpf.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Andrii Nakryiko <[email protected]>:
Quoted 8 lines · On Thu, 8 Feb 2024 15:31:15 +0530 you wrote:
Compiling with
CONFIG_BPF_SYSCALL& !CONFIG_BPF_JIT throws the below warning:"WARN:
resolve_btfids: unresolved symbolbpf_cpumask"Fix it by adding the appropriate #ifdef.
[...]
Here is the summary with links:
- bpf: fix warning for bpf_cpumask in verifier
https://git.kernel.org/bpf/bpf/c/11f522256e90
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html