lkml.org 
[lkml]   [2021]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch 04/31] x86/fpu: Restrict xsaves()/xrstors() to independent states
Date
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@linutronix.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)
{
\
 
 \ /
  Last update: 2021-10-12 02:09    [W:0.340 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site