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/include | |
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/include')
-rw-r--r-- | arch/x86/include/asm/fpu-internal.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h index 409b9ccf5518..831dbb9c6c02 100644 --- a/arch/x86/include/asm/fpu-internal.h +++ b/arch/x86/include/asm/fpu-internal.h | |||
@@ -181,11 +181,28 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx) | |||
181 | "m" (*fx)); | 181 | "m" (*fx)); |
182 | } | 182 | } |
183 | 183 | ||
184 | static inline int fxrstor_user(struct i387_fxsave_struct __user *fx) | ||
185 | { | ||
186 | if (config_enabled(CONFIG_X86_32)) | ||
187 | return user_insn(fxrstor %[fx], "=m" (*fx), [fx] "m" (*fx)); | ||
188 | else if (config_enabled(CONFIG_AS_FXSAVEQ)) | ||
189 | return user_insn(fxrstorq %[fx], "=m" (*fx), [fx] "m" (*fx)); | ||
190 | |||
191 | /* See comment in fpu_fxsave() below. */ | ||
192 | return user_insn(rex64/fxrstor (%[fx]), "=m" (*fx), [fx] "R" (fx), | ||
193 | "m" (*fx)); | ||
194 | } | ||
195 | |||
184 | static inline int frstor_checking(struct i387_fsave_struct *fx) | 196 | static inline int frstor_checking(struct i387_fsave_struct *fx) |
185 | { | 197 | { |
186 | return check_insn(frstor %[fx], "=m" (*fx), [fx] "m" (*fx)); | 198 | return check_insn(frstor %[fx], "=m" (*fx), [fx] "m" (*fx)); |
187 | } | 199 | } |
188 | 200 | ||
201 | static inline int frstor_user(struct i387_fsave_struct __user *fx) | ||
202 | { | ||
203 | return user_insn(frstor %[fx], "=m" (*fx), [fx] "m" (*fx)); | ||
204 | } | ||
205 | |||
189 | static inline void fpu_fxsave(struct fpu *fpu) | 206 | static inline void fpu_fxsave(struct fpu *fpu) |
190 | { | 207 | { |
191 | if (config_enabled(CONFIG_X86_32)) | 208 | if (config_enabled(CONFIG_X86_32)) |