[moderation] [fs?] KCSAN: data-race in generic_fillattr / shmem_mknod (3)

0 views
Skip to first unread message

syzbot

unread,
7:07 PM (1 hour ago) 7:07 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=12160153580000
kernel config: https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=0f9a4f4e9a4c666fe30a
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [bra...@kernel.org ja...@suse.cz linux-...@vger.kernel.org linux-...@vger.kernel.org vi...@zeniv.linux.org.uk]

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:
A data race occurs between directory modification in tmpfs (e.g., shmem_mknod())
and lockless attribute inspection (generic_fillattr()). While stat/statx calls
vfs_getattr_nosec() -> generic_fillattr() -> i_size_read() without holding
inode->i_rwsem, shmem_mknod() directly performs a plain read-modify-write on the
parent directory inode's size (dir->i_size += BOGO_DIRENT_SIZE) instead of using
the concurrency-safe i_size_write() helper. As a result, the unmarked store
races with the marked smp_load_acquire() in i_size_read(), triggering a KCSAN
data race report.

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

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

==================================================================
BUG: KCSAN: data-race in generic_fillattr / shmem_mknod

read (marked) to 0xffff888103e4b9e8 of 8 bytes by task 4356 on cpu 0:
i_size_read include/linux/fs.h:1146 [inline]
generic_fillattr+0x14a/0x340 fs/stat.c:95
shmem_getattr+0x18b/0x210 mm/shmem.c:1539
vfs_getattr_nosec+0x194/0x230 fs/stat.c:217
vfs_getattr+0x48/0x60 fs/stat.c:266
vfs_statx_path+0x28/0x140 fs/stat.c:303
vfs_statx+0xc4/0x170 fs/stat.c:360
vfs_fstatat+0x118/0x170 fs/stat.c:377
__do_sys_newfstatat fs/stat.c:542 [inline]
__se_sys_newfstatat+0x55/0x3e0 fs/stat.c:536
__x64_sys_newfstatat+0x55/0x70 fs/stat.c:536
x64_sys_call+0xee6/0x2550 arch/x86/include/generated/asm/syscalls_64.h:263
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-write to 0xffff888103e4b9e8 of 8 bytes by task 4361 on cpu 1:
shmem_mknod+0x11b/0x170 mm/shmem.c:4104
shmem_create+0x34/0x50 mm/shmem.c:4160
lookup_open+0x84e/0x10a0 fs/namei.c:4575
open_last_lookups fs/namei.c:4774 [inline]
path_openat+0x492/0x11e0 fs/namei.c:5013
do_file_open+0x16c/0x290 fs/namei.c:5045
do_sys_openat2+0xa1/0x140 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_openat fs/open.c:1465 [inline]
__se_sys_openat fs/open.c:1460 [inline]
__x64_sys_openat+0xf2/0x120 fs/open.c:1460
x64_sys_call+0x1f72/0x2550 arch/x86/include/generated/asm/syscalls_64.h:258
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: 1 UID: 0 PID: 4361 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