syzbot


KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_elem (3)

Status: moderation: reported on 2024/09/28 07:04
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+03b9d4f221f429f724ff@syzkaller.appspotmail.com
First crash: 8h34m, last: 8h34m
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_elem (2) bpf 1 66d 66d 0/28 auto-obsoleted due to no activity on 2024/08/28 12:16
upstream KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_elem bpf 1 145d 145d 0/28 auto-obsoleted due to no activity on 2024/06/10 07:44

Sample crash report:
==================================================================
BUG: KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_elem

write to 0xffff888124644468 of 4 bytes by task 6097 on cpu 0:
 __local_list_add_pending kernel/bpf/bpf_lru_list.c:358 [inline]
 bpf_common_lru_pop_free kernel/bpf/bpf_lru_list.c:457 [inline]
 bpf_lru_pop_free+0xc61/0xd30 kernel/bpf/bpf_lru_list.c:504
 prealloc_lru_pop kernel/bpf/hashtab.c:308 [inline]
 __htab_lru_percpu_map_update_elem+0xfe/0x630 kernel/bpf/hashtab.c:1359
 bpf_percpu_hash_update+0x5e/0xa0 kernel/bpf/hashtab.c:2425
 bpf_map_update_value+0x2b1/0x350 kernel/bpf/syscall.c:181
 generic_map_update_batch+0x401/0x520 kernel/bpf/syscall.c:1849
 bpf_map_do_batch+0x28c/0x3f0 kernel/bpf/syscall.c:5143
 __sys_bpf+0x2e5/0x7a0
 __do_sys_bpf kernel/bpf/syscall.c:5741 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5739 [inline]
 __x64_sys_bpf+0x43/0x50 kernel/bpf/syscall.c:5739
 x64_sys_call+0x2625/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:322
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xc9/0x1c0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff888124644468 of 4 bytes by interrupt on cpu 1:
 lookup_nulls_elem_raw kernel/bpf/hashtab.c:667 [inline]
 __htab_map_lookup_elem kernel/bpf/hashtab.c:697 [inline]
 htab_lru_percpu_map_lookup_elem+0xb8/0x1c0 kernel/bpf/hashtab.c:2359
 bpf_prog_67a7f92a6a5e5f13+0x43/0x47
 bpf_dispatcher_nop_func include/linux/bpf.h:1257 [inline]
 __bpf_prog_run include/linux/filter.h:701 [inline]
 bpf_prog_run include/linux/filter.h:708 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2318 [inline]
 bpf_trace_run3+0x10c/0x1d0 kernel/trace/bpf_trace.c:2360
 __traceiter_kmem_cache_free+0x33/0x50 include/trace/events/kmem.h:114
 trace_kmem_cache_free include/trace/events/kmem.h:114 [inline]
 kmem_cache_free+0x237/0x2d0 mm/slub.c:4681
 inode_free_by_rcu+0x36/0x70 security/security.c:1704
 rcu_do_batch kernel/rcu/tree.c:2567 [inline]
 rcu_core+0x57b/0xbc0 kernel/rcu/tree.c:2823
 rcu_core_si+0xd/0x20 kernel/rcu/tree.c:2840
 handle_softirqs+0xbf/0x280 kernel/softirq.c:554
 run_ksoftirqd+0x1c/0x30 kernel/softirq.c:927
 smpboot_thread_fn+0x31c/0x4c0 kernel/smpboot.c:164
 kthread+0x1d1/0x210 kernel/kthread.c:389
 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

value changed: 0xa7066320 -> 0x7687d7cd

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 23 Comm: ksoftirqd/1 Tainted: G        W          6.11.0-syzkaller-11653-g3630400697a3 #0
Tainted: [W]=WARN
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/28 07:03 upstream 3630400697a3 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_elem
* Struck through repros no longer work on HEAD.