Re: [syzbot] [kernel?] KCSAN: data-race in fpu_flush_thread / skb_copy_bits
From: Marco Elver
Date: Thu Nov 19 2026 - 15:54:36 EST
On Thu, 19 Nov 2026 at 21:26, syzbot
<syzbot+b07ec23d35be305855be@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 666539eecdf4 Merge tag 'assoc-array-fixes-v2'
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=14b3c5be580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=b949a9d3c1d44ceb
> dashboard link: https://syzkaller.appspot.com/bug?extid=b07ec23d35be305855be
> compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/a943b9915869/disk-666539ee.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/9bfd839d7ea5/vmlinux-666539ee.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/0f20b9720a71/bzImage-666539ee.xz
>
> AI-generated root cause summary:
> In arch/x86/kernel/fpu/core.c, fpu_flush_thread() calls
> fpstate_reset(x86_task_fpu(current)) before fpu_reset_fpstate_regs() without
> holding fpregs_lock() and while TIF_NEED_FPU_LOAD may still be clear. Because
> preemption and softirqs remain enabled, a context switch into __switch_to() ->
> switch_fpu() (or a softirq using kernel_fpu_begin()) can observe
> !TIF_NEED_FPU_LOAD and invoke save_fpregs_to_fpstate() -> os_xsave(), reading
> fpstate->xfd (via xfd_validate_state()) and fpstate->xfeatures concurrently with
> __fpstate_reset() modifying them. KCSAN reported the same task/CPU with an empty
> read stack and a stale "skb_copy_bits" frame because preemption occurred inside
> KCSAN's delay_tsc(), and __switch_to_asm switches %rsp to the next task's stack
> before __switch_to() calls switch_fpu() while `current` still points to the
> outgoing task, causing arch_stack_walk() to fail and return 0 frames.
The above analysis is confusing. There's a better analysis it did
(https://syzkaller.appspot.com/ai_job?id=45f623b0-666c-486c-a73c-ede5e8eb0ba4):
> CPU0 (task in execve) CPU0 (preempt / softirq)
>
> // Task previously enabled dynamic xfeature:
> // xfd_state == 0, TIF_NEED_FPU_LOAD == 0
> fpu_flush_thread()
> fpstate_reset(fpu) // NO fpregs_lock()!
> fpu->fpstate = &fpu->__fpstate
> __fpstate_reset(fpu->fpstate)
> fpstate->xfeatures = default_features
> fpstate->xfd = init_fpstate.xfd // != 0
>
> <PREEMPT or SOFTIRQ>
> __switch_to() -> switch_fpu()
> (or kernel_fpu_begin_mask())
> // !TIF_NEED_FPU_LOAD is true
> update_fpu_state_and_flag(fpu, current)
> save_fpregs_to_fpstate(fpu)
> os_xsave(fpu->fpstate)
> xfd_validate_state(fpstate, mask, false)
> xstate_op_valid():
> fpstate->xfd != xfd_state (0)
> fpstate->xfd == current->fpu->fpstate->xfd
> -> returns false!
> WARN_ON_ONCE(1) // Kernel warning
> full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=b07ec23d35be305855be
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+b07ec23d35be305855be@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ==================================================================
> BUG: KCSAN: data-race in fpu_flush_thread / skb_copy_bits
>
> read to 0xffff888103fc3058 of 8 bytes by task 15366 on cpu 0:
>
> write to 0xffff888103fc3058 of 8 bytes by task 15366 on cpu 0:
> __fpstate_reset arch/x86/kernel/fpu/core.c:-1 [inline]
> fpstate_reset arch/x86/kernel/fpu/core.c:620 [inline]
> fpu_flush_thread+0x128/0x360 arch/x86/kernel/fpu/core.c:882
> flush_thread+0x40/0x80 arch/x86/kernel/process.c:291
> begin_new_exec+0xcd0/0x1260 fs/exec.c:1235
> load_elf_binary+0x5ee/0x1a00 fs/binfmt_elf.c:1010
> search_binary_handler fs/exec.c:1777 [inline]
> exec_binprm fs/exec.c:1809 [inline]
> bprm_execve+0x480/0xaa0 fs/exec.c:1865
> do_execveat_common+0x6ba/0x720 fs/exec.c:1963
> __do_sys_execve fs/exec.c:2036 [inline]
> __se_sys_execve fs/exec.c:2030 [inline]
> __x64_sys_execve+0x5f/0x80 fs/exec.c:2030
> x64_sys_call+0x1cd2/0x2550 arch/x86/include/generated/asm/syscalls_64.h:60
> 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: 15366 Comm: dhcpcd-run-hook Not tainted syzkaller #0 PREEMPT(lazy)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
> ==================================================================