[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1468253937-40008-3-git-send-email-fenghua.yu@intel.com>
Date: Mon, 11 Jul 2016 09:18:55 -0700
From: "Fenghua Yu" <fenghua.yu@...el.com>
To: "Ingo Molnar" <mingo@...e.hu>,
"Thomas Gleixner" <tglx@...utronix.de>,
"H. Peter Anvin" <h.peter.anvin@...el.com>,
"Dave Hansen" <dave.hansen@...el.com>,
"Ravi V Shankar" <ravi.v.shankar@...el.com>
Cc: Yu-cheng Yu <yu-cheng.yu@...el.com>,
"Fenghua Yu" <fenghua.yu@...el.com>, "x86" <x86@...nel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/4] x86/fpu/xstate: Return NULL for disabled xstate component address
From: Yu-cheng Yu <yu-cheng.yu@...el.com>
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@...el.com>
Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
Reviewed-by: Dave Hansen <dave.hansen@...el.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 f8d1aff..4fb8dd7 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -760,6 +760,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];
}
/*
--
2.5.0
Powered by blists - more mailing lists