[moderation] [kernel?] KCSAN: data-race in __synchronize_irq / handle_irq_event

0 views
Skip to first unread message

syzbot

unread,
7:02 PM (1 hour ago) 7:02 PM
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8dac6df92a2e Merge tag 'nfsd-7.4-1' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13391c03580000
kernel config: https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=a6b82c5f167ee48c9ae4
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [linux-...@vger.kernel.org ra...@rendec.net tg...@kernel.org]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/dfc787d10469/disk-8dac6df9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/db7a8e4799da/vmlinux-8dac6df9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/169073a123bc/bzImage-8dac6df9.xz

AI-generated root cause summary:
KCSAN reports a data race on `irq_common_data::state_use_accessors` between an
interrupt handler clearing `IRQD_IRQ_INPROGRESS` via `irqd_clear()` in
`handle_irq_event()` and a task performing a lockless spin-wait via
`irqd_irq_inprogress()` in `__synchronize_hardirq()`. While `handle_irq_event()`
holds `desc->lock` when calling `irqd_clear()`, `__synchronize_hardirq()`
intentionally polls `irqd_irq_inprogress()` without `desc->lock` before
acquiring `desc->lock` to double-check the state. Because
`irqd_irq_inprogress()` and `irqd_clear()` perform plain, unmarked memory
accesses (`__irqd_to_state(d)`) instead of `READ_ONCE()`/`WRITE_ONCE()` or
`data_race()`, KCSAN flags the concurrent access.

full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=a6b82c5f167ee48c9ae4

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

==================================================================
BUG: KCSAN: data-race in __synchronize_irq / handle_irq_event

read-write to 0xffff8881000cca00 of 4 bytes by interrupt on cpu 0:
irqd_set kernel/irq/internals.h:258 [inline]
handle_irq_event+0x4a/0xf0 kernel/irq/handle.c:260
handle_edge_irq+0x155/0x440 kernel/irq/chip.c:859
generic_handle_irq_desc include/linux/irqdesc.h:188 [inline]
handle_irq arch/x86/kernel/irq.c:209 [inline]
call_irq_handler arch/x86/kernel/irq.c:-1 [inline]
__common_interrupt+0x60/0xb0 arch/x86/kernel/irq.c:280
common_interrupt+0x7e/0x90 arch/x86/kernel/irq.c:273
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665
get_current arch/x86/include/asm/current.h:25 [inline]
get_ctx kernel/kcsan/core.c:206 [inline]
check_access kernel/kcsan/core.c:759 [inline]
__tsan_read_write8+0x115/0x190 kernel/kcsan/core.c:1034
mas_wr_node_store lib/maple_tree.c:3238 [inline]
mas_wr_store_entry+0x3a20/0x5b90 lib/maple_tree.c:3569
mas_store_gfp+0x493/0x580 lib/maple_tree.c:5022
vma_iter_clear_gfp include/linux/mm.h:1839 [inline]
do_vmi_align_munmap+0x2d2/0x4e0 mm/vma.c:1715
do_vmi_munmap+0x1fe/0x240 mm/vma.c:1771
__vm_munmap+0x192/0x2c0 mm/vma.c:3628
__do_sys_munmap mm/mmap.c:1094 [inline]
__se_sys_munmap mm/mmap.c:1091 [inline]
__x64_sys_munmap+0x36/0x50 mm/mmap.c:1091
x64_sys_call+0x23df/0x2550 arch/x86/include/generated/asm/syscalls_64.h:12
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

read to 0xffff8881000cca00 of 4 bytes by task 12103 on cpu 1:
irqd_irq_inprogress include/linux/irq.h:353 [inline]
__synchronize_hardirq kernel/irq/manage.c:61 [inline]
__synchronize_irq+0x71/0x2c0 kernel/irq/manage.c:122
synchronize_irq+0x28/0x40 kernel/irq/manage.c:151
serial8250_do_shutdown+0x174/0x7f0 drivers/tty/serial/8250/8250_port.c:2453
serial8250_shutdown+0x41/0x50 drivers/tty/serial/8250/8250_port.c:2500
uart_port_shutdown drivers/tty/serial/serial_core.c:1892 [inline]
uart_tty_port_shutdown+0x183/0x7b0 drivers/tty/serial/serial_core.c:1760
tty_port_shutdown_locked drivers/tty/tty_port.c:362 [inline]
tty_port_shutdown drivers/tty/tty_port.c:379 [inline]
tty_port_close+0x191/0x250 drivers/tty/tty_port.c:734
uart_close+0x48/0xe0 drivers/tty/serial/serial_core.c:1741
tty_release+0x1e7/0xaf0 drivers/tty/tty_io.c:1720
__fput+0x292/0x660 fs/file_table.c:512
fput_close_sync+0xd5/0x1d0 fs/file_table.c:618
filp_close_sync+0x27/0x40 fs/open.c:1574
__range_close fs/file.c:919 [inline]
__do_sys_close_range fs/file.c:1003 [inline]
__se_sys_close_range+0x765/0x880 fs/file.c:954
__x64_sys_close_range+0x43/0x50 fs/file.c:954
x64_sys_call+0x2198/0x2550 arch/x86/include/generated/asm/syscalls_64.h:437
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

value changed: 0x1d400200 -> 0x1d440200

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 12103 Comm: syz.6.1724 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
Reply all
Reply to author
Forward
0 new messages