KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue

Status: moderation: reported on 2026/11/20 00:04
Subsystems: kernel
Labels: race:benign prio:low
[Documentation on labels]
Reported-by: syzbot+2219bacf405655645232@syzkaller.appspotmail.com
First crash: 2d22h, last: 2d06h
✨ AI-generated root cause summary:

KCSAN detected a 4-byte data race on task_struct::flags between do_execveat_common() in fs/exec.c and posixtimer_get_target() in kernel/signal.c on the same CPU. In task context with interrupts enabled, do_execveat_common() performs an unmarked read-modify-write (current->flags &= ~PF_NPROC_EXCEEDED). When an hrtimer interrupt fires on the same CPU during this operation, posixtimer_get_target() (invoked via posix_timer_fn() -> posix_timer_queue_signal() -> posixtimer_send_sigqueue()) performs an unmarked read of current->flags (!(current->flags & PF_EXITING)) before acquiring sighand->siglock. Because neither access uses READ_ONCE()/WRITE_ONCE() (or WRITE_ONCE with IRQ synchronization), KCSAN flags the concurrent access on current->flags.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 666539eecdf4:

Root Cause Analysis

KCSAN reported a 4-byte read/write data race on task_struct::flags (an unsigned int at offset 44 bytes / 352 bits in struct task_struct) occurring on the same CPU (cpu 0) between task context and hardirq context:

  1. Task-context write (fs/exec.c:1914): In do_execveat_common(), the executing task (current, PID 4267) clears PF_NPROC_EXCEEDED (0x00001000) with interrupts enabled using an unmarked read-modify-write:

    current->flags &= ~PF_NPROC_EXCEEDED;
    
  2. Interrupt-context read (kernel/signal.c:2027): While do_execveat_common() is executing (and delayed by KCSAN's watchpoint in kcsan_setup_watchpoint()), an APIC timer interrupt fires on the same CPU and invokes posix_timer_fn() -> posix_timer_queue_signal() -> posixtimer_send_sigqueue() (kernel/signal.c:2056). Before calling lock_task_sighand(), posixtimer_send_sigqueue() calls posixtimer_get_target() (kernel/signal.c:2022-2030), which reads current->flags to check PF_EXITING (0x00000004):

    static inline struct task_struct *posixtimer_get_target(struct k_itimer *tmr)
    {
        struct task_struct *t = pid_task(tmr->it_pid, tmr->it_pid_type);
    
        if (t && tmr->it_pid_type != PIDTYPE_PID &&
            same_thread_group(t, current) && !(current->flags & PF_EXITING))
            t = current;
        return t;
    }
    

    Because current in the interrupt handler refers to the interrupted task (task 4267) on CPU 0, posixtimer_get_target() reads the exact same current->flags field concurrently with the unmarked modification in do_execveat_common().

Synchronisation / Invariant Violated

As noted in include/linux/sched.h:1838-1848, task_struct::flags is generally updated by current itself without a lock, while exit_signals() (kernel/signal.c:3210-3211) sets PF_EXITING under spinlock_irq(&tsk->sighand->siglock).

However, posixtimer_get_target() runs in hardirq context without holding sighand->siglock and reads current->flags via an unmarked access (!(current->flags & PF_EXITING)), while do_execveat_common() (and other task-context flag updates that do not disable interrupts) modifies current->flags via an unmarked read-modify-write (&= ~PF_NPROC_EXCEEDED). Under KCSAN's memory model, this constitutes an unmarked data race on current->flags. Using READ_ONCE(current->flags) in posixtimer_get_target() and WRITE_ONCE(current->flags, ...) (or appropriate atomic/accessor helpers) for concurrent task-context flag updates resolves the unmarked race.

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
2b1e2f3a assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ✅ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue 2026/11/19 17:47 2026/11/19 17:47 2026/11/19 17:52 229865fb
57d597a7 assessment-kcsan Benign: ✅ ❓ KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue 2026/11/19 17:37 2026/11/19 17:37 2026/11/19 17:49 229865fb

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

read to 0xffff8881019bc52c of 4 bytes by interrupt on cpu 0:
 posixtimer_get_target kernel/signal.c:2027 [inline]
 posixtimer_send_sigqueue+0xd8/0x8d0 kernel/signal.c:2056
 posix_timer_queue_signal kernel/time/posix-timers.c:365 [inline]
 posix_timer_fn+0x93/0xc0 kernel/time/posix-timers.c:380
 __run_hrtimer kernel/time/hrtimer.c:2079 [inline]
 __hrtimer_run_queues+0x1f8/0x540 kernel/time/hrtimer.c:2136
 hrtimer_interrupt+0x27b/0x870 kernel/time/hrtimer.c:2255
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1051 [inline]
 __sysvec_apic_timer_interrupt+0x5f/0x1f0 arch/x86/kernel/apic/apic.c:1068
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
 sysvec_apic_timer_interrupt+0x6f/0x80 arch/x86/kernel/apic/apic.c:1062
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
 native_pause arch/x86/include/asm/vdso/processor.h:13 [inline]
 delay_tsc+0x43/0xa0 arch/x86/lib/delay.c:76
 udelay include/asm-generic/delay.h:64 [inline]
 delay_access kernel/kcsan/core.c:332 [inline]
 kcsan_setup_watchpoint+0x255/0x3f0 kernel/kcsan/core.c:622
 do_execveat_common+0xf3/0x720 fs/exec.c:1914
 __do_sys_execveat fs/exec.c:2047 [inline]
 __se_sys_execveat fs/exec.c:2040 [inline]
 __x64_sys_execveat+0x76/0xa0 fs/exec.c:2040
 x64_sys_call+0x21ae/0x2550 arch/x86/include/generated/asm/syscalls_64.h:323
 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 0xffff8881019bc52c of 4 bytes by task 4267 on cpu 0:
 do_execveat_common+0xf3/0x720 fs/exec.c:1914
 __do_sys_execveat fs/exec.c:2047 [inline]
 __se_sys_execveat fs/exec.c:2040 [inline]
 __x64_sys_execveat+0x76/0xa0 fs/exec.c:2040
 x64_sys_call+0x21ae/0x2550 arch/x86/include/generated/asm/syscalls_64.h:323
 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: 4267 Comm: syz.0.285 Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================
process 'syz.0.285' launched './file0' with NULL argv: empty string added

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/17 18:55 upstream 666539eecdf4 122f94d5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue
2026/11/17 18:54 upstream 666539eecdf4 122f94d5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue
2026/11/17 11:56 upstream 666539eecdf4 43af6cac .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue
2026/11/17 11:55 upstream 666539eecdf4 43af6cac .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue
2026/11/17 03:26 upstream 666539eecdf4 a3e64cfc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in do_execveat_common / posixtimer_send_sigqueue
* Struck through repros no longer work on HEAD.