diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-09-25 18:42:18 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-09-25 18:42:18 -0400 |
commit | e139e95590dfebab81841bf7a3ac46500f51a47c (patch) | |
tree | 2094d5154d34ce212c7110ed3a30d975026e5c75 /arch/x86/kernel/xsave.c | |
parent | 49b8c695e331c9685e6ffdbf34872509d77c8459 (diff) |
x86, smap: Do not abuse the [f][x]rstor_checking() functions for user space
With SMAP, the [f][x]rstor_checking() functions are no longer usable
for user-space pointers by applying a simple __force cast. Instead,
create new [f][x]rstor_user() functions which do the proper SMAP
magic.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1343171129-2747-3-git-send-email-suresh.b.siddha@intel.com
Diffstat (limited to 'arch/x86/kernel/xsave.c')
-rw-r--r-- | arch/x86/kernel/xsave.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 4e89b3dd408d..ada87a329edc 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -315,7 +315,7 @@ static inline int restore_user_xstate(void __user *buf, u64 xbv, int fx_only) | |||
315 | if ((unsigned long)buf % 64 || fx_only) { | 315 | if ((unsigned long)buf % 64 || fx_only) { |
316 | u64 init_bv = pcntxt_mask & ~XSTATE_FPSSE; | 316 | u64 init_bv = pcntxt_mask & ~XSTATE_FPSSE; |
317 | xrstor_state(init_xstate_buf, init_bv); | 317 | xrstor_state(init_xstate_buf, init_bv); |
318 | return fxrstor_checking((__force void *) buf); | 318 | return fxrstor_user(buf); |
319 | } else { | 319 | } else { |
320 | u64 init_bv = pcntxt_mask & ~xbv; | 320 | u64 init_bv = pcntxt_mask & ~xbv; |
321 | if (unlikely(init_bv)) | 321 | if (unlikely(init_bv)) |
@@ -323,9 +323,9 @@ static inline int restore_user_xstate(void __user *buf, u64 xbv, int fx_only) | |||
323 | return xrestore_user(buf, xbv); | 323 | return xrestore_user(buf, xbv); |
324 | } | 324 | } |
325 | } else if (use_fxsr()) { | 325 | } else if (use_fxsr()) { |
326 | return fxrstor_checking((__force void *) buf); | 326 | return fxrstor_user(buf); |
327 | } else | 327 | } else |
328 | return frstor_checking((__force void *) buf); | 328 | return frstor_user(buf); |
329 | } | 329 | } |
330 | 330 | ||
331 | int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) | 331 | int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) |