Re: [PATCH] x86/fpu: Free dynamic fpstate on exec()
From: Dave Hansen
Date: Tue Sep 29 2026 - 12:54:16 EST
On 9/29/26 08:10, Guixiong Wei wrote:
> Preserve the old fpstate pointer across fpstate_reset() and free it only
> after fpu_reset_fpstate_regs() has invalidated FPU register ownership.
> This ordering prevents a context switch from saving FPU registers through
> a freed fpstate pointer.
Are there any fpstate_reset() paths where this matters?
I mean, the init task, obviously not. It doesn't have a dynamic fpstate.
During exec() this reset happens while:
bprm->mm = NULL;
among other things, so I really don't think it's even remotely in the
context of getting context-switched to.
For clone(), the destination task is also not in any condition to be
context-switched to.
So why defend against context switching? What am I missing?