x86/fpu: Preserve supervisor states in sanitize_restored_user_xstate()
authorThomas Gleixner <tglx@linutronix.de>
Fri, 18 Jun 2021 14:18:24 +0000 (16:18 +0200)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:47:26 +0000 (08:47 -0400)
commit51d8011782ed751b5982914f18776be9eb9be062
tree996fcb2de4868747c97708d676d6dd81288b0cf3
parent2b35a4eaaaae26f3f22bfb1a8b7ca1e994bae063
x86/fpu: Preserve supervisor states in sanitize_restored_user_xstate()

commit 9301982c424a003c0095bf157154a85bf5322bd0 upstream.

sanitize_restored_user_xstate() preserves the supervisor states only
when the fx_only argument is zero, which allows unprivileged user space
to put supervisor states back into init state.

Preserve them unconditionally.

 [ bp: Fix a typo or two in the text. ]

Fixes: 5d6b6a6f9b5c ("x86/fpu/xstate: Update sanitize_restored_xstate() for supervisor xstates")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20210618143444.438635017@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/fpu/signal.c