[moderation] [bpf?] KCSAN: data-race in bpf_lru_pop_free / htab_lru_percpu_map_lookup_percpu_elem

0 views
Skip to first unread message

syzbot

unread,
Apr 11, 2024, 8:41:27 AMApr 11
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9875c0beb8ad Merge tag 'media/v6.9-2' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1303854d180000
kernel config: https://syzkaller.appspot.com/x/.config?x=6a1ac6d65bf295c5
dashboard link: https://syzkaller.appspot.com/bug?extid=e9a7c1a52e85f3087b46
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
CC: [and...@kernel.org a...@kernel.org b...@vger.kernel.org dan...@iogearbox.net edd...@gmail.com hao...@google.com john.fa...@gmail.com jo...@kernel.org kps...@kernel.org linux-...@vger.kernel.org marti...@linux.dev s...@google.com so...@kernel.org yongho...@linux.dev]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/092d24a777b9/disk-9875c0be.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f7293189ba1a/vmlinux-9875c0be.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f9d2a97aaf72/bzImage-9875c0be.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+e9a7c1...@syzkaller.appspotmail.com

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
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages