Re: [syzbot] [kernel?] KCSAN: data-race in fpu_flush_thread / skb_copy_bits

From: Chang S. Bae

Date: Sat Nov 21 2026 - 17:08:51 EST


On 11/19/2026 1:11 PM, Dave Hansen wrote:

Chang, any chance you'd want to dig in and make sure this is a real issue?

Commit c20942ce5128 ("x86/fpu/core: Convert to fpstate") had the update:
/*
- * Use fpregs_lock() while editing CPU's FPU registers or fpu->state.
+ * Use fpregs_lock() while editing CPU's FPU registers or fpu->fpstate.
* A context switch will (and softirq might) save CPU's FPU register to
- * fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in
+ * fpu->fpstate.regs and set TIF_NEED_FPU_LOAD leaving CPU's FPU ...

Previously fpregs_lock() was required whenever either the FPU registers or the XSAVE buffer itself being updated. With AMX, fpstate was introduced as a container for the XSTATE. fpstate.regs holds the actual storage, but size/feature/permission attributes are metadata much like the XSAVE header.

Thus, the comment change makes sense and most likely intentional, so the attached change does. Now, commit e61d6310a0f8 ("x86/fpu: Reset permission and fpstate on exec()") which looks really ugly and mistep in this sense.

Then including fpstate_reset(), fpu_reset_fpstate_regs() could be renamed to fpu_reset_fpstate() perhaps, as it now has only one caller following the recent cleanup: ab05214025ee ("x86/fpu: Remove MATH_EMULATION and related glue code").

The resulting sequence then becomes almost the same to the one in fpu_clone(). Given these subtleties, it might be better to combine and centralize the reset sequence if possible.

I also think freeing the old vmalloc'ed memory after the lock release could be included there. So a bit of surgery seems warranted rather than the on-going one:
https://lore.kernel.org/all/cover.1793604327.git.weiguixiong@xxxxxxxxxxxxx/

Let me prepare a set of patches if anything else.

Thanks,
Chang