syzbot


KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_percpu_elem

Status: auto-obsoleted due to no activity on 2024/05/16 12:41
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+e9a7c1a52e85f3087b46@syzkaller.appspotmail.com
First crash: 241d, last: 241d
Similar bugs (1)
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_percpu_elem (2) bpf 1 27d 27d 0/28 moderation: reported on 2024/11/10 16:57

Sample crash report:
loop0: detected capacity change from 0 to 4096
==================================================================
BUG: KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_percpu_elem

write to 0xffff8881141191a8 of 4 bytes by task 10099 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+0xc72/0xd50 kernel/bpf/bpf_lru_list.c:504
 prealloc_lru_pop kernel/bpf/hashtab.c:305 [inline]
 __htab_lru_percpu_map_update_elem+0xfe/0x630 kernel/bpf/hashtab.c:1352
 bpf_percpu_hash_update+0x5e/0xa0 kernel/bpf/hashtab.c:2392
 bpf_map_update_value+0x2b1/0x350 kernel/bpf/syscall.c:181
 generic_map_update_batch+0x401/0x520 kernel/bpf/syscall.c:1876
 bpf_map_do_batch+0x2f8/0x440 kernel/bpf/syscall.c:5174
 __sys_bpf+0x2e5/0x7a0
 __do_sys_bpf kernel/bpf/syscall.c:5767 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5765 [inline]
 __x64_sys_bpf+0x43/0x50 kernel/bpf/syscall.c:5765
 x64_sys_call+0x86c/0x2d30 arch/x86/include/generated/asm/syscalls_64.h:322
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1d0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff8881141191a8 of 4 bytes by task 10097 on cpu 1:
 lookup_nulls_elem_raw kernel/bpf/hashtab.c:661 [inline]
 __htab_map_lookup_elem kernel/bpf/hashtab.c:691 [inline]
 htab_lru_percpu_map_lookup_percpu_elem+0xe3/0x200 kernel/bpf/hashtab.c:2343
 ____bpf_map_lookup_percpu_elem kernel/bpf/helpers.c:133 [inline]
 bpf_map_lookup_percpu_elem+0x44/0x60 kernel/bpf/helpers.c:130
 ___bpf_prog_run+0x9ab/0x46c0 kernel/bpf/core.c:1997
 __bpf_prog_run32+0x74/0xa0 kernel/bpf/core.c:2236
 bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline]
 __bpf_prog_run include/linux/filter.h:657 [inline]
 bpf_prog_run include/linux/filter.h:664 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline]
 bpf_trace_run2+0x97/0x150 kernel/trace/bpf_trace.c:2420
 trace_kfree include/trace/events/kmem.h:94 [inline]
 kfree+0x1e7/0x270 mm/slub.c:4377
 free_modprobe_argv+0x44/0x50 kernel/module/kmod.c:69
 call_usermodehelper_freeinfo kernel/umh.c:43 [inline]
 call_usermodehelper_exec+0xbc/0x2c0 kernel/umh.c:463
 call_modprobe kernel/module/kmod.c:103 [inline]
 __request_module+0x27a/0x3e0 kernel/module/kmod.c:173
 blk_request_module+0x109/0x140 block/genhd.c:796
 blkdev_get_no_open+0x43/0xe0 block/bdev.c:748
 bdev_file_open_by_dev+0x9c/0x250 block/bdev.c:968
 swsusp_check+0x3f/0x260 kernel/power/swap.c:1574
 software_resume+0x43/0x2e0 kernel/power/hibernate.c:990
 resume_store+0x34e/0x3a0 kernel/power/hibernate.c:1264
 kobj_attr_store+0x47/0x70 lib/kobject.c:840
 sysfs_kf_write+0xae/0xd0 fs/sysfs/file.c:136
 kernfs_fop_write_iter+0x1ce/0x2c0 fs/kernfs/file.c:334
 call_write_iter include/linux/fs.h:2110 [inline]
 new_sync_write fs/read_write.c:497 [inline]
 vfs_write+0x771/0x8e0 fs/read_write.c:590
 ksys_pwrite64 fs/read_write.c:705 [inline]
 __do_sys_pwrite64 fs/read_write.c:715 [inline]
 __se_sys_pwrite64 fs/read_write.c:712 [inline]
 __x64_sys_pwrite64+0xf7/0x150 fs/read_write.c:712
 x64_sys_call+0x92f/0x2d30 arch/x86/include/generated/asm/syscalls_64.h:19
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1d0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x4ef37847 -> 0x72e5134a

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 10097 Comm: syz-executor.0 Tainted: G        W          6.9.0-rc3-syzkaller-00068-g9875c0beb8ad #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/11 12:40 upstream 9875c0beb8ad 33b9e058 .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_percpu_elem
* Struck through repros no longer work on HEAD.