Re: [patch V2 00/52] x86/fpu: Spring cleaning and PKRU sanitizing

From: Yu, Yu-cheng
Date: Tue Jun 15 2021 - 20:50:18 EST


On 6/14/2021 8:44 AM, Thomas Gleixner wrote:
The main parts of this series are:

- Yet more bug fixes

- Simplification and removal/replacement of redundant and/or
overengineered code.

- Name space cleanup as the existing names were just a permanent source
of confusion.

- Clear seperation of user ABI and kernel internal state handling.

- Removal of PKRU from being XSTATE managed in the kernel because PKRU
has to be eagerly restored on context switch and keeping it in sync
in the xstate buffer is just pointless overhead and fragile.

The kernel still XSAVEs PKRU on context switch but the value in the
buffer is not longer used and never restored from the buffer.

This still needs to be cleaned up, but the series is already 40+
patches large and the cleanup of this is not a functional problem.

The functional issues of PKRU management are fully addressed with the
series as is.

It applies on top of

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master

and is also available via git:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu

This is a follow up to V1 which can be found here:

https://lore.kernel.org/r/20210611161523.508908024@xxxxxxxxxxxxx

Changes vs. V1:

- Fix the broken init_fpstate initialization

- Make xstate copy to ptrace work correctly

- Sanitize the regset functions more and get rid of
fpstate_sanitize_xstate().

- Addressed review comments

- Picked up tags

Thanks,

tglx
---
arch/x86/events/intel/lbr.c | 6
arch/x86/include/asm/fpu/internal.h | 179 +++-------
arch/x86/include/asm/fpu/xstate.h | 70 ++-
arch/x86/include/asm/pgtable.h | 57 ---
arch/x86/include/asm/pkeys.h | 9
arch/x86/include/asm/pkru.h | 62 +++
arch/x86/include/asm/processor.h | 9
arch/x86/include/asm/special_insns.h | 14
arch/x86/kernel/cpu/common.c | 29 -
arch/x86/kernel/fpu/core.c | 242 +++++++++----
arch/x86/kernel/fpu/init.c | 4
arch/x86/kernel/fpu/regset.c | 177 ++++-----
arch/x86/kernel/fpu/signal.c | 59 +--
arch/x86/kernel/fpu/xstate.c | 620 ++++++++++++++---------------------
arch/x86/kernel/process.c | 19 +
arch/x86/kernel/process_64.c | 28 +
arch/x86/kvm/svm/sev.c | 1
arch/x86/kvm/x86.c | 56 +--
arch/x86/mm/extable.c | 2
arch/x86/mm/fault.c | 2
arch/x86/mm/pkeys.c | 22 -
include/linux/pkeys.h | 4
22 files changed, 818 insertions(+), 853 deletions(-)



I applied shadow stack, IBT on top of this series, and ran routine tests. All passed with one small change to patch #45 (see reply to that one).

Thanks,
Yu-cheng