Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1398588 > unrolled thread

[PATCH v6 11/13] x86/xsaves: When a disabled xstate component offset is requested, return NULL

Started byYu-cheng Yu <yu-cheng.yu@intel.com>
First post2016-05-11 01:40 +0200
Last post2016-05-11 01:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v6 11/13] x86/xsaves: When a disabled xstate component offset is requested, return NULL Yu-cheng Yu <yu-cheng.yu@intel.com> - 2016-05-11 01:40 +0200

#1398588 — [PATCH v6 11/13] x86/xsaves: When a disabled xstate component offset is requested, return NULL

FromYu-cheng Yu <yu-cheng.yu@intel.com>
Date2016-05-11 01:40 +0200
Subject[PATCH v6 11/13] x86/xsaves: When a disabled xstate component offset is requested, return NULL
Message-ID<rxppV-4nc-27@gated-at.bofh.it>
It is an error to request a disabled XSAVE/XSAVES component address.
For that case, make __raw_xsave_addr() return a NULL and issue a
warning.

Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
---
 arch/x86/kernel/fpu/xstate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index a913d4e..7c2cdc4 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -761,6 +761,11 @@ void *__raw_xsave_addr(struct xregs_state *xsave, int xstate_feature_mask)
 {
 	int feature_nr = fls64(xstate_feature_mask) - 1;
 
+	if (!xfeature_enabled(feature_nr)) {
+		WARN_ON_FPU(1);
+		return NULL;
+	}
+
 	return (void *)xsave + xstate_comp_offsets[feature_nr];
 }
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web