From: tip-bot for Yu-cheng Yu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: yu-cheng.yu@intel.com, h.peter.anvin@intel.com,
linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com,
torvalds@linux-foundation.org, peterz@infradead.org,
fenghua.yu@intel.com, mingo@kernel.org, ravi.v.shankar@intel.com,
dave.hansen@intel.com
Subject: [tip:x86/fpu] x86/fpu/xstate: Return NULL for disabled xstate component address
Date: Mon, 11 Jul 2016 09:13:22 -0700 [thread overview]
Message-ID: <tip-5060b91513b866f774da15dfd82157864c4b1683@git.kernel.org> (raw)
In-Reply-To: <1468253937-40008-3-git-send-email-fenghua.yu@intel.com>
Commit-ID: 5060b91513b866f774da15dfd82157864c4b1683
Gitweb: http://git.kernel.org/tip/5060b91513b866f774da15dfd82157864c4b1683
Author: Yu-cheng Yu <yu-cheng.yu@intel.com>
AuthorDate: Mon, 11 Jul 2016 09:18:55 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 11 Jul 2016 16:44:00 +0200
x86/fpu/xstate: Return NULL for disabled xstate component address
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>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: H. Peter Anvin <h.peter.anvin@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi V Shankar <ravi.v.shankar@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1468253937-40008-3-git-send-email-fenghua.yu@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
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];
}
/*
next prev parent reply other threads:[~2016-07-11 16:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-11 16:18 [PATCH 0/4] x86/fpu/xstate: Fix XSAVES issues - Part 3 Fenghua Yu
2016-07-11 16:18 ` [PATCH 1/4] x86/fpu/xstate: Fix __fpu_restore_sig() for XSAVES Fenghua Yu
2016-07-11 16:12 ` [tip:x86/fpu] " tip-bot for Yu-cheng Yu
2016-07-11 16:18 ` [PATCH 2/4] x86/fpu/xstate: Return NULL for disabled xstate component address Fenghua Yu
2016-07-11 16:13 ` tip-bot for Yu-cheng Yu [this message]
2016-07-11 16:18 ` [PATCH 3/4] x86/fpu/xstate: Fix fpstate_init() for XRSTORS Fenghua Yu
2016-07-11 16:13 ` [tip:x86/fpu] " tip-bot for Yu-cheng Yu
2016-07-11 16:18 ` [PATCH 4/4] x86/fpu/xstate: Re-enable XSAVES Fenghua Yu
2016-07-11 16:14 ` [tip:x86/fpu] " tip-bot for Yu-cheng Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-5060b91513b866f774da15dfd82157864c4b1683@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dave.hansen@intel.com \
--cc=fenghua.yu@intel.com \
--cc=h.peter.anvin@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.v.shankar@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=yu-cheng.yu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome