KCSAN: data-race in task_dump_owner / task_dump_owner (2)

Status: moderation: reported on 2026/11/23 02:36
Subsystems: fs
Labels: race:harmful prio:low
[Documentation on labels]
Reported-by: syzbot+01225feba16a0f7227e3@syzkaller.appspotmail.com
First crash: 43m, last: 43m
✨ AI-generated root cause summary:

During concurrent VFS lookups of the same /proc/<pid> dentry, lookup_fast() invokes pid_revalidate() without holding any inode lock (including in RCU-walk mode). pid_revalidate() calls pid_update_inode(), which calls task_dump_owner(task, inode->i_mode, &inode->i_uid, &inode->i_gid). task_dump_owner() performs plain, unsynchronized 4-byte writes to inode->i_uid and inode->i_gid, causing concurrent writers across CPUs to race on the same struct inode fields.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 4843f6873f7c:

Root Cause Analysis

The KCSAN data race occurs when multiple tasks concurrently traverse and revalidate the same /proc/<pid> dentry during VFS path lookup.

  1. Unserialized Revalidation Path (fs/namei.c, fs/proc/base.c): During openat() (do_sys_openat2() -> do_file_open() -> path_openat() -> link_path_walk() -> walk_component() -> lookup_fast()), the VFS calls d_revalidate() on cached dentries. For procfs task dentries using pid_dentry_operations, .d_revalidate is pid_revalidate() (fs/proc/base.c:2043).

    Unlike tid_fd_revalidate() (fs/proc/fd.c:143) or map_files_d_revalidate() (fs/proc/base.c:2179), pid_revalidate() does not reject LOOKUP_RCU with -ECHILD, and even in non-RCU ref-walk mode d_revalidate() is invoked without holding inode->i_lock or inode->i_rwsem on the target inode:

    rcu_read_lock();
    inode = d_inode_rcu(dentry);
    if (!inode)
        goto out;
    task = pid_task(proc_pid(inode), PIDTYPE_PID);
    
    if (task) {
        pid_update_inode(task, inode);
        ret = 1;
    }
    
  2. Unsynchronized Writes to struct inode Ownership Fields (fs/proc/base.c): pid_update_inode() (fs/proc/base.c:2030) refreshes the inode's ownership and mode in place:

    void pid_update_inode(struct task_struct *task, struct inode *inode)
    {
        task_dump_owner(task, inode->i_mode, &inode->i_uid, &inode->i_gid);
    
        inode->i_mode &= ~(S_ISUID | S_ISGID);
        security_task_to_inode(task, inode);
    }
    

    Inside task_dump_owner() (fs/proc/base.c:1862), the computed kuid_t and kgid_t values are written with plain stores directly to *ruid (&inode->i_uid, 4 bytes at offset 24 in struct inode) and *rgid (&inode->i_gid, 4 bytes at offset 28) at lines 1873–1874 (PF_KTHREAD) or lines 1908–1909 (*ruid = uid; *rgid = gid;).

  3. Concurrent Trigger: When two CPUs simultaneously look up the same /proc/<pid> dentry (here tasks 6557 and 6556 executing openat()), both enter pid_revalidate() -> pid_update_inode() -> task_dump_owner() concurrently and perform unmarked 4-byte writes to the same inode->i_uid / inode->i_gid address (0xffff88811b422a60), triggering the data-race in task_dump_owner / task_dump_owner report.

Related Unsynchronized Sites

  • In pid_update_inode(), inode->i_mode is also read without READ_ONCE() and updated via an unsynchronized read-modify-write (inode->i_mode &= ~(S_ISUID | S_ISGID);).
  • While selinux_task_to_inode() takes isec->lock, other security_task_to_inode() hooks such as smack_task_to_inode() (security/smack/smack_lsm.c:2433) also mutate inode->i_security fields without locking.
  • Similarly, map_files_d_revalidate() (fs/proc/base.c:2213) and tid_fd_revalidate() -> tid_fd_update_inode() (fs/proc/fd.c:130) call task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid) in ref-walk d_revalidate without per-inode locking, so they can also race under concurrent lookups.
▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
5829c62a assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ✅ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ KCSAN: data-race in task_dump_owner / task_dump_owner (2) 2026/11/23 02:12 2026/11/23 02:13 2026/11/23 02:35 b2c69459
5e5b9bf3 assessment-kcsan Benign: ❌ ❓ KCSAN: data-race in task_dump_owner / task_dump_owner (2) 2026/11/23 02:12 2026/11/23 02:12 2026/11/23 02:21 b2c69459
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in task_dump_owner / task_dump_owner fs 6 27 2568d 2593d 0/29 auto-closed as invalid on 2020/01/20 18:34

Sample crash report:
==================================================================
BUG: KCSAN: data-race in task_dump_owner / task_dump_owner

write to 0xffff88811b422a60 of 4 bytes by task 6557 on cpu 0:
 task_dump_owner+0x146/0x170 fs/proc/base.c:-1
 pid_update_inode fs/proc/base.c:2032 [inline]
 pid_revalidate+0x65/0xb0 fs/proc/base.c:2057
 d_revalidate fs/namei.c:1041 [inline]
 lookup_fast+0x232/0x320 fs/namei.c:1874
 walk_component fs/namei.c:2284 [inline]
 link_path_walk+0x5d9/0xde0 fs/namei.c:2659
 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

write to 0xffff88811b422a60 of 4 bytes by task 6556 on cpu 1:
 task_dump_owner+0x146/0x170 fs/proc/base.c:-1
 pid_update_inode fs/proc/base.c:2032 [inline]
 pid_revalidate+0x65/0xb0 fs/proc/base.c:2057
 d_revalidate fs/namei.c:1041 [inline]
 lookup_fast+0x232/0x320 fs/namei.c:1874
 walk_component fs/namei.c:2284 [inline]
 link_path_walk+0x5d9/0xde0 fs/namei.c:2659
 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

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 6556 Comm: syz.5.482 Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/23 02:12 upstream 4843f6873f7c b2c69459 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in task_dump_owner / task_dump_owner
* Struck through repros no longer work on HEAD.