[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211011223610.524176686@linutronix.de>
Date: Tue, 12 Oct 2021 02:00:04 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: x86@...nel.org, "Chang S. Bae" <chang.seok.bae@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
kvm@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>
Subject: [patch 04/31] x86/fpu: Restrict xsaves()/xrstors() to independent states
These interfaces are really only valid for features which are independently
managed and not part of the task context state for various reasons.
Tighten the checks and adjust the misleading comments.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
arch/x86/kernel/fpu/xstate.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -1182,13 +1182,9 @@ static bool validate_xsaves_xrstors(u64
if (WARN_ON_FPU(!cpu_feature_enabled(X86_FEATURE_XSAVES)))
return false;
/*
- * Validate that this is either a task->fpstate related component
- * subset or an independent one.
+ * Validate that this is a independent compoment.
*/
- if (mask & xfeatures_mask_independent())
- xchk = ~xfeatures_mask_independent();
- else
- xchk = ~xfeatures_mask_all;
+ xchk = ~xfeatures_mask_independent();
if (WARN_ON_ONCE(!mask || mask & xchk))
return false;
@@ -1206,8 +1202,7 @@ static bool validate_xsaves_xrstors(u64
* buffer should be zeroed otherwise a consecutive XRSTORS from that buffer
* can #GP.
*
- * The feature mask must either be a subset of the independent features or
- * a subset of the task->fpstate related features.
+ * The feature mask must be a subset of the independent features
*/
void xsaves(struct xregs_state *xstate, u64 mask)
{
@@ -1231,8 +1226,7 @@ void xsaves(struct xregs_state *xstate,
* Proper usage is to restore the state which was saved with
* xsaves() into @xstate.
*
- * The feature mask must either be a subset of the independent features or
- * a subset of the task->fpstate related features.
+ * The feature mask must be a subset of the independent features
*/
void xrstors(struct xregs_state *xstate, u64 mask)
{
Powered by blists - more mailing lists