Re: [PATCH tip/x86/fpu 6/6] x86/fpu: shift fpregs_assert_state_consistent() from arch_exit_work() to its caller

From: Ingo Molnar
Date: Sun May 04 2025 - 04:36:25 EST



* Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> If CONFIG_X86_DEBUG_FPU=Y, arch_exit_to_user_mode_prepare() calls
> arch_exit_work() even if ti_work == 0. There only reason is that we
> want to call fpregs_assert_state_consistent() if TIF_NEED_FPU_LOAD
> is not set.
>
> This looks confusing. arch_exit_to_user_mode_prepare() can just call
> fpregs_assert_state_consistent() unconditionally, it depends on
> CONFIG_X86_DEBUG_FPU and checks TIF_NEED_FPU_LOAD itself.
>
> Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
> ---
> arch/x86/include/asm/entry-common.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Thanks Oleg! I've applied these improvements to tip:x86/fpu.

Note that there's still a 32-bit hardened-usercopy regression/crash
that Boris reported against tip:x86/fpu:

https://lore.kernel.org/r/20250503120712.GJaBYG8A-D77MllFZ3@fat_crate.local

Which may result in the subsequent rebasing of your commits - but
otherwise your series looks good to me.

Thanks,

Ingo