Re: [PATCH] x86/fpu: hold fpregs_lock() across fpstate_reset() in fpu_flush_thread()
From: Dave Hansen
Date: Mon Nov 23 2026 - 11:12:08 EST
On 11/23/26 05:17, Ömer Mete Kaya wrote:
> fpstate_reset() updates the fpstate pointer before resetting its size
> and feature metadata without holding fpregs_lock(). If the task is
> preempted during this transition, switch_fpu_prepare() can save the FPU
> registers using the stale feature configuration into the newly selected,
> smaller buffer, potentially causing an out-of-bounds write into the
> embedded fpstate buffer.
>
> Hold fpregs_lock() across fpstate_reset() to prevent a context switch
> or softirq from accessing the partially updated FPU state.
>
> Closes: https://syzkaller.appspot.com/bug?extid=58cbd7974a103b8b8916
> Fixes: e61d6310a0f8 ("x86/fpu: Reset permission and fpstate on exec()")
> Signed-off-by: Ömer Mete Kaya <omermetekaya0@xxxxxxxxx>
Hi Omer,
I'm genuinely curious how you came across this issue and decided to send
a patch for it.
Did you happen to read the other (brief) conversation on it?
https://lore.kernel.org/lkml/6aff5b8e.4ea6388a.d0c9.0001.GAE@xxxxxxxxxx/