Skip to content

x86/fpu: avoid math_state_restore() on kthread exec

Oleg Nesterov lkml stable 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 26 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4x86/fpu: document user_fpu_begin()arch/x86/include/asm/fpu-internal.h+3 -12 replies
2/4x86/fpu: introduce restore_init_xstate()arch/x86/include/asm/fpu-internal.h+10 -64 replies
3/4x86/fpu: use restore_init_xstate() instead of math_state_restore() on kthread execarch/x86/kernel/process.c+2 -13 replies
4/4x86/fpu: don't abuse drop_init_fpu() in flush_thread()arch/x86/kernel/process.c+4 -722 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchIngo Molnar
1/4
2/4
3/4
4/4A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] x86/fpu: avoid math_state_restore() on kthread exec

Hello.

This should "fix" the kernel crash observed by Dave.

But let me repeat once again, the problem is that fpu_finit() is buggy on Dave's machine. This series should "hide" this problem, we need to fix it later anyway.

I was going to do these changes anyway, math_state_restore() was only used because we did not have the necessary helpers. I was going to start with init_fpu() cleanups, but since math_state_restore() makes this fpu_finit() bug more visible lets remove it first.

Note that init_fpu() + user_fpu_begin() is racy, used_math() is already set so __switch_to() in between can do restore_fpu_checking() too and trigger the same GPF. But this is fine (to some degree), the task won't be killed. And this is just another proof that init_fpu() should not set used_math() and it and its users need more cleanups.

More to come tomorrow.

Oleg.