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

From: Ingo Molnar
Date: Sat Sep 23 2017 - 09:01:00 EST


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(-)

--
2.11.0