[patch 0/8] x86/fpu: Mop up XSAVES and related damage
From: Thomas Gleixner
Date: Wed Jun 02 2021 - 06:19:23 EST
syszbot reported a warnon for XRSTOR raising #GP:
https://lore.kernel.org/r/0000000000004c453905c30f8334@xxxxxxxxxx
with a syzcaller reproducer and a conclusive bisect result.
It took a while to destill a simple C reproducer out of it which allowed to
pin point the root cause: The recent addition of supervisor XSTATEs broke
the signal restore path for the case where the signal handler wreckaged the
XSTATE on stack because it does not sanitize the XSTATE header which causes
a subsequent XRSTOR to fail and #GP.
The following series addresses the problem and fixes related issues which
were found while inspecting the related changes.
Thanks to Andy and Dave for working on this with me!
Thanks,
tglx
---
arch/x86/include/asm/fpu/xstate.h | 4
arch/x86/kernel/fpu/core.c | 62 ++++++---
arch/x86/kernel/fpu/regset.c | 43 ++----
arch/x86/kernel/fpu/signal.c | 30 +++-
arch/x86/kernel/fpu/xstate.c | 95 +++++----------
b/tools/testing/selftests/x86/corrupt_xstate_header.c | 114 ++++++++++++++++++
tools/testing/selftests/x86/Makefile | 3
7 files changed, 234 insertions(+), 117 deletions(-)