Skip to content

x86 FPU fixes and cleanups for v4.14

Ingo Molnar kernel-hardening lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest33 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/33x86/fpu: Rename copyin_to_xsaves()/copyout_from_xsaves() to copy_user_to_xstate()/copy_xstate_to_user()arch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/signal.c +1 more+7 -70 replies
2/33x86/fpu: Split copy_xstate_to_user() into copy_xstate_to_kernel() & copy_xstate_to_user()arch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/xstate.c+109 -100 replies
3/33x86/fpu: Remove 'ubuf' parameter from the copy_xstate_to_kernel() APIsarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/xstate.c+8 -170 replies
4/33x86/fpu: Remove 'kbuf' parameter from the copy_xstate_to_user() APIsarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/xstate.c+9 -200 replies
5/33x86/fpu: Clean up parameter order in the copy_xstate_to_*() APIsarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/xstate.c+16 -170 replies
6/33x86/fpu: Clean up the parameter definitions of copy_xstate_to_*()arch/x86/kernel/fpu/xstate.c+5 -50 replies
7/33x86/fpu: Remove the 'start_pos' parameter from the __copy_xstate_to_*() functionsarch/x86/kernel/fpu/xstate.c+10 -100 replies
8/33x86/fpu: Clarify parameter names in the copy_xstate_to_*() methodsarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/xstate.c+24 -242 replies
9/33x86/fpu: Change 'size_total' parameter to unsigned and standardize the size checks in copy_xstate_to_*()arch/x86/kernel/fpu/xstate.c+15 -170 replies
10/33x86/fpu: Simplify __copy_xstate_to_kernel() return valuesarch/x86/kernel/fpu/xstate.c+5 -120 replies
11/33x86/fpu: Split copy_user_to_xstate() into copy_kernel_to_xstate() & copy_user_to_xstate()arch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/xstate.c+74 -60 replies
12/33x86/fpu: Remove 'ubuf' parameter from the copy_kernel_to_xstate() APIarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/xstate.c+5 -160 replies
13/33x86/fpu: Remove 'kbuf' parameter from the copy_user_to_xstate() APIarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/signal.c +1 more+11 -230 replies
14/33x86/fpu: Flip the parameter order in copy_*_to_xstate()arch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/signal.c +1 more+7 -70 replies
15/33x86/fpu: Simplify fpu->fpregs_active usearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/signal.c +1 more+8 -220 replies
16/33x86/fpu: Make the fpu state change in fpu__clear() scheduler-atomicarch/x86/kernel/fpu/core.c+2 -00 replies
17/33x86/fpu: Split the state handling in fpu__drop()arch/x86/kernel/fpu/core.c+13 -60 replies
18/33x86/fpu: Change fpu->fpregs_active users to fpu->fpstate_activearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/signal.c +1 more+17 -100 replies
19/33x86/fpu: Decouple fpregs_activate()/fpregs_deactivate() from fpu->fpregs_activearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c+2 -80 replies
20/33x86/fpu: Remove struct fpu::fpregs_activearch/x86/include/asm/fpu/internal.h arch/x86/include/asm/fpu/types.h arch/x86/include/asm/trace/fpu.h +2 more+1 -430 replies
21/33x86/fpu: Add FPU state copying quirk to handle XRSTOR failure on Intel Skylake CPUsarch/x86/include/asm/fpu/types.h arch/x86/kernel/fpu/xstate.c+45 -00 replies
22/33x86/fpu: Fix boolreturn.cocci warningsarch/x86/kernel/fpu/xstate.c+3 -30 replies
23/33x86/fpu: Turn WARN_ON() in context switch into WARN_ON_FPU()arch/x86/include/asm/fpu/internal.h+1 -10 replies
24/33x86/fpu: Don't let userspace set bogus xcomp_bvarch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/signal.c+11 -20 replies
25/33x86/fpu: Tighten validation of user-supplied xstate_headerarch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/regset.c arch/x86/kernel/fpu/signal.c +1 more+60 -550 replies
26/33x86/fpu: Reinitialize FPU registers if restoring FPU state failsarch/x86/include/asm/fpu/internal.h arch/x86/mm/extable.c+39 -360 replies
27/33x86/fpu: Simplify fpu__activate_fpstate_read()arch/x86/kernel/fpu/core.c+8 -160 replies
28/33x86/fpu: Remove fpu__current_fpstate_write_begin/end()arch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c+0 -650 replies
29/33x86/fpu: Rename fpu::fpstate_active to fpu::initializedarch/x86/ia32/ia32_signal.c arch/x86/include/asm/fpu/internal.h arch/x86/include/asm/fpu/types.h +8 more+35 -350 replies
30/33x86/fpu: Fix stale comments about lazy FPU logicarch/x86/kernel/fpu/core.c+3 -60 replies
31/33x86/fpu: Simplify and speed up fpu__copy()arch/x86/kernel/fpu/core.c+3 -120 replies
32/33x86/fpu: Rename fpu__activate_curr() to fpu__initialize()arch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/signal.c +2 more+8 -80 replies
33/33x86/fpu: Rename fpu__activate_fpstate_read/write() to fpu__read/write()arch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/regset.c+10 -100 replies

Reviews trailers per patch

3 of 33 patches have a Reviewed-by or Acked-by.

PatchRik van RielKees CookDave Hansen
1/33
2/33
3/33
4/33
5/33
6/33
7/33
8/33
9/33
10/33
11/33
12/33
13/33
14/33
15/33
16/33
17/33
18/33
19/33
20/33
21/33
22/33
23/33
24/33R-b R-b A-b
25/33R-b R-b A-b
26/33R-b
27/33
28/33
29/33
30/33
31/33
32/33
33/33

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 00/33] x86 FPU fixes and cleanups for v4.14

So I'd like to push these changes to Linus tomorrow-ish as an RFC pull request in 1-2 days, because there's now 4 fixes depending on these changes, and because the result will be more maintainable for the LTS v4.14 kernel.

The biggest changes from the earlier iterations is the fixes from Eric Biggers for information leaks, plus more cleanups. I have also removed the change that Peter Zijlstra and others felt uneasy about, the ::last_cpu -> ::fpregs_cached change to the state machine. This should make the changes uncontroversial.

Due to taking out that patch I had to rebase the changes, most of which have accrued months of testing in linux-next. So I'm pretty confident about the overall stability of it. (Famous last words.)

Thanks,

Ingo

===============>

Andi Kleen (1):
x86/fpu: Turn WARN_ON() in context switch into WARN_ON_FPU()

Eric Biggers (3):
x86/fpu: Don't let userspace set bogus xcomp_bv x86/fpu: Tighten validation of user-supplied xstate_header x86/fpu: Reinitialize FPU registers if restoring FPU state fails

Ingo Molnar (27):
x86/fpu: Rename copyin_to_xsaves()/copyout_from_xsaves() to copy_user_to_xstate()/copy_xstate_to_user() x86/fpu: Split copy_xstate_to_user() into copy_xstate_to_kernel() & copy_xstate_to_user() x86/fpu: Remove 'ubuf' parameter from the copy_xstate_to_kernel() APIs
x86/fpu: Remove 'kbuf' parameter from the copy_xstate_to_user() APIs
x86/fpu: Clean up parameter order in the copy_xstate_to_*() APIs
x86/fpu: Clean up the parameter definitions of copy_xstate_to_*()
x86/fpu: Remove the 'start_pos' parameter from the __copy_xstate_to_*() functions x86/fpu: Clarify parameter names in the copy_xstate_to_*() methods
x86/fpu: Change 'size_total' parameter to unsigned and standardize the size checks in copy_xstate_to_*() x86/fpu: Simplify __copy_xstate_to_kernel() return values
x86/fpu: Split copy_user_to_xstate() into copy_kernel_to_xstate() & copy_user_to_xstate() x86/fpu: Remove 'ubuf' parameter from the copy_kernel_to_xstate() API
x86/fpu: Remove 'kbuf' parameter from the copy_user_to_xstate() API
x86/fpu: Flip the parameter order in copy_*_to_xstate()
x86/fpu: Simplify fpu->fpregs_active use
x86/fpu: Make the fpu state change in fpu__clear() scheduler-atomic
x86/fpu: Split the state handling in fpu__drop()
x86/fpu: Change fpu->fpregs_active users to fpu->fpstate_active
x86/fpu: Decouple fpregs_activate()/fpregs_deactivate() from fpu->fpregs_active x86/fpu: Remove struct fpu::fpregs_active
x86/fpu: Simplify fpu__activate_fpstate_read()
x86/fpu: Remove fpu__current_fpstate_write_begin/end()
x86/fpu: Rename fpu::fpstate_active to fpu::initialized
x86/fpu: Fix stale comments about lazy FPU logic
x86/fpu: Simplify and speed up fpu__copy()
x86/fpu: Rename fpu__activate_curr() to fpu__initialize()
x86/fpu: Rename fpu__activate_fpstate_read/write() to fpu__read/write()

Rik van Riel (1):
x86/fpu: Add FPU state copying quirk to handle XRSTOR failure on Intel Skylake CPUs

kbuild test robot (1):
x86/fpu: Fix boolreturn.cocci warnings

 arch/x86/ia32/ia32_signal.c         |   2 +-
 arch/x86/include/asm/fpu/internal.h |  90 ++++++---------------
 arch/x86/include/asm/fpu/types.h    |  32 ++------
 arch/x86/include/asm/fpu/xstate.h   |  33 +++++++-
 arch/x86/include/asm/trace/fpu.h    |  11 +--
 arch/x86/kernel/fpu/core.c          | 158 +++++++++----------------------------
 arch/x86/kernel/fpu/init.c          |   2 +-
 arch/x86/kernel/fpu/regset.c        |  48 ++++++------
 arch/x86/kernel/fpu/signal.c        |  36 +++++----
 arch/x86/kernel/fpu/xstate.c        | 240 ++++++++++++++++++++++++++++++++++++++++++++------------
 arch/x86/kernel/signal.c            |   6 +-
 arch/x86/kvm/x86.c                  |   2 +-
 arch/x86/math-emu/fpu_entry.c       |   2 +-
 arch/x86/mm/extable.c               |  24 ++++++
 arch/x86/mm/pkeys.c                 |   3 +-
 15 files changed, 367 insertions(+), 322 deletions(-)
Signature · 1 line
2.11.0