[moderation] [fs?] KCSAN: data-race in inode_set_flags / security_inode_permission

0 views
Skip to first unread message

syzbot

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

syzbot found the following issue on:

HEAD commit: 4405c18c95d2 Merge tag 'mm-nonmm-hotfixes-stable-2026-11-1..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17f8fda1580000
kernel config: https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=4437fdfb1ddbe4e98755
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/bc2915167a4c/disk-4405c18c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/cdf4152506d9/vmlinux-4405c18c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/04690243718a/bzImage-4405c18c.xz

AI-generated root cause summary:
KCSAN reports a data race on the 4-byte `inode->i_flags` field between
`inode_set_flags()` in `fs/inode.c` (via `shmem_fileattr_set()` /
`vfs_fileattr_set()`) and unmarked reads of `inode->i_flags` via
`IS_PRIVATE(inode)` in `security_inode_permission()` and `inode_sid_has_perm()`.
Although `vfs_fileattr_set()` holds `inode->i_rwsem` and `inode_set_flags()`
updates `i_flags` atomically using `set_mask_bits()` (`try_cmpxchg`), `open()`
paths (`may_open()` and `do_dentry_open()`) check `inode->i_flags` without
holding `i_rwsem` and without `READ_ONCE()`. This is a benign data race because
`i_flags` is a 32-bit aligned bitmask updated atomically and `S_PRIVATE` is not
modified concurrently.

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

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

==================================================================
BUG: KCSAN: data-race in inode_set_flags / security_inode_permission

read-write (marked) to 0xffff888104caa694 of 4 bytes by task 3328 on cpu 0:
instrument_atomic_read_write include/linux/instrumented.h:113 [inline]
inode_set_flags+0x81/0x110 fs/inode.c:2839
shmem_set_inode_flags mm/shmem.c:3266 [inline]
shmem_fileattr_set+0xe7/0x190 mm/shmem.c:4434
vfs_fileattr_set+0x6a4/0x6f0 fs/file_attr.c:306
ioctl_setflags+0x2c7/0x300 fs/file_attr.c:342
do_vfs_ioctl+0x65d/0xe80 fs/ioctl.c:561
__do_sys_ioctl fs/ioctl.c:596 [inline]
__se_sys_ioctl+0x82/0x140 fs/ioctl.c:584
__x64_sys_ioctl+0x43/0x50 fs/ioctl.c:584
x64_sys_call+0x239d/0x2550 arch/x86/include/generated/asm/syscalls_64.h:17
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 0xffff888104caa694 of 4 bytes by task 3329 on cpu 1:
security_inode_permission+0x22/0xb0 security/security.c:1863
inode_permission+0x1e3/0x3c0 fs/namei.c:661
may_open+0x25b/0x350 fs/namei.c:4275
do_open fs/namei.c:4849 [inline]
path_openat+0xb71/0x11e0 fs/namei.c:5016
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: 3329 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================
==================================================================
BUG: KCSAN: data-race in inode_set_flags / selinux_file_open

read-write (marked) to 0xffff888104caa694 of 4 bytes by task 3328 on cpu 0:
instrument_atomic_read_write include/linux/instrumented.h:113 [inline]
inode_set_flags+0x81/0x110 fs/inode.c:2839
shmem_set_inode_flags mm/shmem.c:3266 [inline]
shmem_fileattr_set+0xe7/0x190 mm/shmem.c:4434
vfs_fileattr_set+0x6a4/0x6f0 fs/file_attr.c:306
ioctl_setflags+0x2c7/0x300 fs/file_attr.c:342
do_vfs_ioctl+0x65d/0xe80 fs/ioctl.c:561
__do_sys_ioctl fs/ioctl.c:596 [inline]
__se_sys_ioctl+0x82/0x140 fs/ioctl.c:584
__x64_sys_ioctl+0x43/0x50 fs/ioctl.c:584
x64_sys_call+0x239d/0x2550 arch/x86/include/generated/asm/syscalls_64.h:17
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 0xffff888104caa694 of 4 bytes by task 3329 on cpu 1:
inode_sid_has_perm security/selinux/hooks.c:1694 [inline]
inode_has_perm security/selinux/hooks.c:1707 [inline]
file_path_has_perm security/selinux/hooks.c:1757 [inline]
selinux_file_open+0x26f/0x340 security/selinux/hooks.c:4408
security_file_open+0x32/0x60 security/security.c:2761
do_dentry_open+0x1fd/0xab0 fs/open.c:977
vfs_open_consume+0x47/0x210 fs/open.c:1131
do_open fs/namei.c:4851 [inline]
path_openat+0xc16/0x11e0 fs/namei.c:5016
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: 3329 Comm: syz-executor 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