Hello,
syzbot found the following issue on:
HEAD commit: 666539eecdf4 Merge tag 'assoc-array-fixes-v2'
git tree: upstream
console output:
https://syzkaller.appspot.com/x/log.txt?x=13a5ce4d580000
kernel config:
https://syzkaller.appspot.com/x/.config?x=b949a9d3c1d44ceb
dashboard link:
https://syzkaller.appspot.com/bug?extid=c4bf3ea5e84bca4f8665
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [
and...@kernel.org a...@kernel.org b...@vger.kernel.org dan...@iogearbox.net edd...@gmail.com em...@etsalapatis.com ihor.s...@linux.dev jo...@kernel.org linux-...@vger.kernel.org marti...@linux.dev mem...@gmail.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/a943b9915869/disk-666539ee.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/9bfd839d7ea5/vmlinux-666539ee.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/0f20b9720a71/bzImage-666539ee.xz
AI-generated root cause summary:
In kernel/bpf/memalloc.c, the per-CPU struct bpf_mem_cache uses the field 'tgt'
as an approximate cache hint to guide freed memory units back to the allocating
CPU's cache. In unit_free_rcu() (line 907) and unit_free() (line 874), c->tgt is
updated using an unsynchronized, plain write outside interrupt-disabled
sections. Concurrently, an in-flight RCU callback __free_by_rcu() (line 394)
reads c->tgt using a plain load without synchronization or marked access. In the
reported scenario, task context executing unit_free_rcu() on CPU 0 was
interrupted by a timer interrupt whose softirq executed __free_by_rcu(),
resulting in a KCSAN data race on c->tgt.
full analysis:
https://syzkaller.appspot.com/x/ai_root_cause?x=c4bf3ea5e84bca4f8665
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+c4bf3e...@syzkaller.appspotmail.com
==================================================================
BUG: KCSAN: data-race in __free_by_rcu / unit_free_rcu
read to 0xffffe8ffffc37c98 of 8 bytes by interrupt on cpu 0:
__free_by_rcu+0x30/0x1e0 kernel/bpf/memalloc.c:394
rcu_do_batch kernel/rcu/tree.c:2650 [inline]
rcu_core+0x76e/0xcb0 kernel/rcu/tree.c:2919
rcu_core_si+0xd/0x20 kernel/rcu/tree.c:2936
handle_softirqs+0x109/0x310 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x40/0xf0 kernel/softirq.c:786
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0x74/0x80 arch/x86/kernel/apic/apic.c:1062
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
__preempt_count_dec_and_test arch/x86/include/asm/preempt.h:123 [inline]
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
_raw_spin_unlock_irqrestore+0x1a/0x30 kernel/locking/spinlock.c:221
spin_unlock_irqrestore include/linux/spinlock.h:425 [inline]
lruvec_unlock_irqrestore include/linux/memcontrol.h:1577 [inline]
folio_batch_move_lru+0x384/0x420 mm/folio.c:200
__folio_batch_add_and_move+0x163/0x1e0 mm/folio.c:225
folio_add_lru+0x9f/0x190 mm/folio.c:492
folio_add_lru_vma+0x5d/0x80 mm/folio.c:511
map_anon_folio_pte_nopf+0x1ef/0x3f0 mm/memory.c:5518
map_anon_folio_pte_pf+0x7d/0x180 mm/memory.c:5528
do_anonymous_page mm/memory.c:5631 [inline]
do_pte_missing mm/memory.c:4776 [inline]
handle_pte_fault mm/memory.c:6665 [inline]
__handle_mm_fault mm/memory.c:6817 [inline]
handle_mm_fault+0x37f1/0x3880 mm/memory.c:6984
do_user_addr_fault+0x3ce/0xde0 arch/x86/mm/fault.c:1343
handle_page_fault arch/x86/mm/fault.c:1483 [inline]
exc_page_fault+0x62/0xa0 arch/x86/mm/fault.c:1536
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595
write to 0xffffe8ffffc37c98 of 8 bytes by task 4568 on cpu 0:
unit_free_rcu+0x3f/0x1f0 kernel/bpf/memalloc.c:907
bpf_mem_cache_free_rcu+0x3e/0x50 kernel/bpf/memalloc.c:997
trie_update_elem+0x8cc/0x950 kernel/bpf/lpm_trie.c:451
bpf_map_update_value+0x4f7/0x570 kernel/bpf/syscall.c:297
generic_map_update_batch+0x4e6/0x700 kernel/bpf/syscall.c:2125
bpf_map_do_batch+0x26a/0x3b0 kernel/bpf/syscall.c:5849
__sys_bpf+0x784/0xc50 kernel/bpf/syscall.c:-1
__do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
__x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 4568 Comm: syz.6.98 Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================
---
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