[moderation] [fs?] KCSAN: data-race in 0x0 / fsnotify_destroy_mark

0 views
Skip to first unread message

syzbot

unread,
7:01 PM (1 hour ago) 7:01 PM
to syzkaller-upst...@googlegroups.com
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=10f19e85580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b949a9d3c1d44ceb
dashboard link: https://syzkaller.appspot.com/bug?extid=887981c8c035f12de9f3
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [amir...@gmail.com ja...@suse.cz linux-...@vger.kernel.org linux-...@vger.kernel.org]

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:
With CONFIG_KCSAN_STRICT=y, KCSAN does not ignore accesses to &current->flags
and sets up a write watchpoint in kcsan_setup_watchpoint() on the plain RMW
`current->flags |= PF_MEMALLOC_NOFS` in memalloc_flags_save() during
fsnotify_destroy_mark(). Because kcsan_setup_watchpoint() leaves
current->kcsan_ctx enabled and delay_tsc() re-enables preemption during
delay_access(), task 3284 can be preempted into __schedule() on CPU 0 while its
watchpoint is live and in_task() still reports true. A KCSAN-instrumented 4-byte
read of task_3284->flags during that preemption/context-switch window consumes
the watchpoint while %rsp has already switched to the next task's stack before
current_task is updated in __switch_to(), causing __unwind_start() to fail stack
validation and report `0x0 / fsnotify_destroy_mark` with an empty stack trace.

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

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

==================================================================
BUG: KCSAN: data-race in 0x0 / fsnotify_destroy_mark

read to 0xffff88810487c52c of 4 bytes by task 3284 on cpu 0:

read-write to 0xffff88810487c52c of 4 bytes by task 3284 on cpu 0:
memalloc_flags_save include/linux/sched/mm.h:335 [inline]
memalloc_nofs_save include/linux/sched/mm.h:388 [inline]
fsnotify_group_lock include/linux/fsnotify_backend.h:290 [inline]
fsnotify_destroy_mark+0x4e/0x140 fs/notify/mark.c:665
__do_sys_inotify_rm_watch fs/notify/inotify/inotify_user.c:793 [inline]
__se_sys_inotify_rm_watch+0x97/0x110 fs/notify/inotify/inotify_user.c:774
__x64_sys_inotify_rm_watch+0x31/0x40 fs/notify/inotify/inotify_user.c:774
x64_sys_call+0x1f51/0x2550 arch/x86/include/generated/asm/syscalls_64.h:256
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: 3284 Comm: udevd 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