Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1440744
| From | tip-bot for Yu-cheng Yu <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:x86/fpu] x86/fpu/xstate: Return NULL for disabled xstate component address |
| Date | 2016-07-11 18:20 +0200 |
| Message-ID | <rTM66-10U-15@gated-at.bofh.it> (permalink) |
| References | <rTJhU-7vn-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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];
}
/*
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] x86/fpu/xstate: Fix XSAVES issues - Part 3 "Fenghua Yu" <fenghua.yu@intel.com> - 2016-07-11 15:20 +0200
[PATCH 1/4] x86/fpu/xstate: Fix __fpu_restore_sig() for XSAVES "Fenghua Yu" <fenghua.yu@intel.com> - 2016-07-11 15:20 +0200
[tip:x86/fpu] x86/fpu/xstate: Fix __fpu_restore_sig() for XSAVES tip-bot for Yu-cheng Yu <tipbot@zytor.com> - 2016-07-11 18:20 +0200
[PATCH 2/4] x86/fpu/xstate: Return NULL for disabled xstate component address "Fenghua Yu" <fenghua.yu@intel.com> - 2016-07-11 15:20 +0200
[tip:x86/fpu] x86/fpu/xstate: Return NULL for disabled xstate component address tip-bot for Yu-cheng Yu <tipbot@zytor.com> - 2016-07-11 18:20 +0200
[PATCH 3/4] x86/fpu/xstate: Fix fpstate_init() for XRSTORS "Fenghua Yu" <fenghua.yu@intel.com> - 2016-07-11 15:20 +0200
[tip:x86/fpu] x86/fpu/xstate: Fix fpstate_init() for XRSTORS tip-bot for Yu-cheng Yu <tipbot@zytor.com> - 2016-07-11 18:20 +0200
csiph-web