bpf: bpf_stackmap_copy depends on CONFIG_PERF_EVENTS
Subsystems (4)
PATCH 1/1 bpf: bpf_stackmap_copy depends on CONFIG_PERF_EVENTS
0-day bot reported build error:kernel/built-in.o: In function `map_lookup_elem':
Quoted 1 line
Quoted 1 line
kernel/bpf/.tmp_syscall.o:(.text+0x329b3c): undefined reference to `bpf_stackmap_copy'
when CONFIG_BPF_SYSCALL is set and CONFIG_PERF_EVENTS is not. Add weak definition to resolve it.
This code path in map_lookup_elem() is never taken when CONFIG_PERF_EVENTS is not set.
--- kernel/bpf/syscall.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/syscall.c +5 -0
@@ -244,6 +244,11 @@ static void __user *u64_to_ptr(__u64 val)return (void __user *) (unsigned long ) val; } +int __weak bpf_stackmap_copy (struct bpf_map *map,void *key,void *value) +{ +return -ENOTSUPP ; +} +/* last field in 'union bpf_attr' used by this command */ #define BPF_MAP_LOOKUP_ELEM_LAST_FIELD value
Signature · 1 line
2.8.0.rc1
From: Alexei Starovoitov <[email protected]>
Date: Wed, 9 Mar 2016 18:56:49 -0800
Quoted 11 lines
0-day bot reported build error:
kernel/built-in.o: In function `map_lookup_elem':Quoted 1 line
Quoted 1 line
kernel/bpf/.tmp_syscall.o:(.text+0x329b3c): undefined reference to `bpf_stackmap_copy'
when
CONFIG_BPF_SYSCALLis set andCONFIG_PERF_EVENTSis not. Add weak definition to resolve it.
This code path inmap_lookup_elem()is never taken whenCONFIG_PERF_EVENTSis not set.Fixes 557c0c6e7df8 ("bpf: convert stackmap to pre-allocation")Reported-by Fengguang Wu <[email protected]>Signed-off-by Alexei Starovoitov <[email protected]>
Applied.