syzbot


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

Status: moderation: reported on 2025/02/03 08:24
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+040dd2b93e1c8a640783@syzkaller.appspotmail.com
First crash: 1d22h, last: 1d22h
Similar bugs (3)
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 (3) bpf 1 129d 129d 0/28 auto-obsoleted due to no activity on 2024/11/02 07:04
upstream KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_elem (2) bpf 1 195d 195d 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 274d 274d 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 0xffff8881169567e8 of 4 bytes by task 13245 on cpu 1:
 bpf_percpu_lru_pop_free kernel/bpf/bpf_lru_list.c:426 [inline]
 bpf_lru_pop_free+0x197/0xd30 kernel/bpf/bpf_lru_list.c:502
 prealloc_lru_pop kernel/bpf/hashtab.c:308 [inline]
 __htab_lru_percpu_map_update_elem+0xfe/0x630 kernel/bpf/hashtab.c:1376
 bpf_percpu_hash_update+0x5e/0xa0 kernel/bpf/hashtab.c:2446
 bpf_map_update_value+0x2ab/0x3b0 kernel/bpf/syscall.c:265
 generic_map_update_batch+0x401/0x520 kernel/bpf/syscall.c:1954
 bpf_map_do_batch+0x28c/0x3f0 kernel/bpf/syscall.c:5302
 __sys_bpf+0x2e5/0x7a0
 __do_sys_bpf kernel/bpf/syscall.c:5901 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5899 [inline]
 __x64_sys_bpf+0x43/0x50 kernel/bpf/syscall.c:5899
 x64_sys_call+0x2914/0x2dc0 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 0xffff8881169567e8 of 4 bytes by task 2968 on cpu 0:
 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:2380
 bpf_prog_67a7f92a6a5e5f13+0x43/0x47
 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [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:2371 [inline]
 bpf_trace_run2+0x104/0x1d0 kernel/trace/bpf_trace.c:2412
 __traceiter_kfree+0x2b/0x50 include/trace/events/kmem.h:94
 __do_trace_kfree include/trace/events/kmem.h:94 [inline]
 trace_kfree include/trace/events/kmem.h:94 [inline]
 kfree+0x247/0x2f0 mm/slub.c:4744
 usb_control_msg+0x214/0x240 drivers/usb/core/message.c:160
 get_port_status drivers/usb/core/hub.c:605 [inline]
 hub_ext_port_status+0xbf/0x480 drivers/usb/core/hub.c:622
 usb_hub_port_status drivers/usb/core/hub.c:672 [inline]
 port_event drivers/usb/core/hub.c:5716 [inline]
 hub_event+0x538/0x2910 drivers/usb/core/hub.c:5905
 process_one_work kernel/workqueue.c:3236 [inline]
 process_scheduled_works+0x483/0x9a0 kernel/workqueue.c:3317
 worker_thread+0x51d/0x6f0 kernel/workqueue.c:3398
 kthread+0x4ae/0x520 kernel/kthread.c:464
 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

value changed: 0x9cdae4c1 -> 0xea173e13

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 2968 Comm: kworker/0:2 Not tainted 6.13.0-syzkaller-10033-gd79bc8f79baa #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Workqueue: usb_hub_wq hub_event
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/03 08:23 upstream d79bc8f79baa 568559e4 .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.