[moderation] [kernfs?] KCSAN: data-race in generic_permission / kernfs_iop_permission

0 views
Skip to first unread message

syzbot

unread,
7:03 PM (1 hour ago) 7:03 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=158cdfed580000
kernel config: https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=5a5937e5f82f0e8fa8ec
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [drive...@lists.linux.dev gre...@linuxfoundation.org linux-...@vger.kernel.org t...@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:
kernfs_iop_permission() in fs/kernfs/inode.c acquires only a shared read lock
(down_read(&root->kernfs_iattr_rwsem)) before calling kernfs_refresh_inode(kn,
inode) and generic_permission(). Because down_read() permits concurrent
execution on the same inode, one task's plain 2-byte write to inode->i_mode in
kernfs_refresh_inode() races with another task's plain 2-byte read of
inode->i_mode in acl_permission_check() (via generic_permission()), as well as
with concurrent kernfs_refresh_inode() calls in kernfs_iop_permission() and
kernfs_iop_getattr().

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

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

==================================================================
BUG: KCSAN: data-race in generic_permission / kernfs_iop_permission

write to 0xffff888107516f88 of 2 bytes by task 3731 on cpu 1:
kernfs_refresh_inode fs/kernfs/inode.c:169 [inline]
kernfs_iop_permission+0x9d/0x220 fs/kernfs/inode.c:287
do_inode_permission fs/namei.c:583 [inline]
inode_permission+0x2b4/0x3c0 fs/namei.c:653
lookup_inode_permission_may_exec fs/namei.c:-1 [inline]
may_lookup fs/namei.c:1967 [inline]
link_path_walk+0x881/0xde0 fs/namei.c:2610
path_openat+0x142/0x11e0 fs/namei.c:5012
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

read to 0xffff888107516f88 of 2 bytes by task 3010 on cpu 0:
acl_permission_check fs/namei.c:441 [inline]
generic_permission+0x2a/0x470 fs/namei.c:529
kernfs_iop_permission+0x1fd/0x220 fs/kernfs/inode.c:288
do_inode_permission fs/namei.c:583 [inline]
inode_permission+0x2b4/0x3c0 fs/namei.c:653
lookup_inode_permission_may_exec fs/namei.c:-1 [inline]
may_lookup fs/namei.c:1967 [inline]
link_path_walk+0x881/0xde0 fs/namei.c:2610
path_lookupat+0x53/0x4c0 fs/namei.c:2818
filename_lookup+0x18f/0x390 fs/namei.c:2848
do_readlinkat+0x74/0x2f0 fs/stat.c:575
__do_sys_readlink fs/stat.c:609 [inline]
__se_sys_readlink fs/stat.c:606 [inline]
__x64_sys_readlink+0x47/0x60 fs/stat.c:606
x64_sys_call+0x1d41/0x2550 arch/x86/include/generated/asm/syscalls_64.h:90
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: 3010 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