Skip to content

Commit b8cdc05

Browse files
4astdavem330
authored andcommitted
bpf: bpf_stackmap_copy depends on CONFIG_PERF_EVENTS
0-day bot reported build error: kernel/built-in.o: In function `map_lookup_elem': >> 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. Fixes: 557c0c6 ("bpf: convert stackmap to pre-allocation") Reported-by: Fengguang Wu <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3b8377d commit b8cdc05

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/bpf/syscall.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ static void __user *u64_to_ptr(__u64 val)
244244
return (void __user *) (unsigned long) val;
245245
}
246246

247+
int __weak bpf_stackmap_copy(struct bpf_map *map, void *key, void *value)
248+
{
249+
return -ENOTSUPP;
250+
}
251+
247252
/* last field in 'union bpf_attr' used by this command */
248253
#define BPF_MAP_LOOKUP_ELEM_LAST_FIELD value
249254

0 commit comments

Comments
 (0)