aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/ia32/ptrace32.c6
-rw-r--r--include/asm-x86_64/i387.h4
-rw-r--r--include/asm-x86_64/uaccess.h46
3 files changed, 33 insertions, 23 deletions
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
index 72bf92a9d375..d18198ed636b 100644
--- a/arch/x86_64/ia32/ptrace32.c
+++ b/arch/x86_64/ia32/ptrace32.c
@@ -375,8 +375,10 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
375 ret = -EIO; 375 ret = -EIO;
376 if (!access_ok(VERIFY_READ, u, sizeof(*u))) 376 if (!access_ok(VERIFY_READ, u, sizeof(*u)))
377 break; 377 break;
378 /* no checking to be bug-to-bug compatible with i386 */ 378 /* no checking to be bug-to-bug compatible with i386. */
379 __copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)); 379 /* but silence warning */
380 if (__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)))
381 ;
380 set_stopped_child_used_math(child); 382 set_stopped_child_used_math(child);
381 child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask; 383 child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask;
382 ret = 0; 384 ret = 0;
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
index 60c0f4853fdb..0217b74cc9fc 100644
--- a/include/asm-x86_64/i387.h
+++ b/include/asm-x86_64/i387.h
@@ -137,8 +137,8 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
137#else 137#else
138 : [fx] "cdaSDb" (fx), "0" (0)); 138 : [fx] "cdaSDb" (fx), "0" (0));
139#endif 139#endif
140 if (unlikely(err)) 140 if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct)))
141 __clear_user(fx, sizeof(struct i387_fxsave_struct)); 141 err = -EFAULT;
142 /* No need to clear here because the caller clears USED_MATH */ 142 /* No need to clear here because the caller clears USED_MATH */
143 return err; 143 return err;
144} 144}
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index bc6812009bd7..802a4a068ef6 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -237,14 +237,18 @@ do { \
237 */ 237 */
238 238
239/* Handles exceptions in both to and from, but doesn't do access_ok */ 239/* Handles exceptions in both to and from, but doesn't do access_ok */
240extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 240__must_check unsigned long
241extern unsigned long copy_user_generic_dontzero(void *to, const void *from, unsigned len); 241copy_user_generic(void *to, const void *from, unsigned len);
242 242
243extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 243__must_check unsigned long
244extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 244copy_to_user(void __user *to, const void *from, unsigned len);
245extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 245__must_check unsigned long
246 246copy_from_user(void *to, const void __user *from, unsigned len);
247static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 247__must_check unsigned long
248copy_in_user(void __user *to, const void __user *from, unsigned len);
249
250static __always_inline __must_check
251int __copy_from_user(void *dst, const void __user *src, unsigned size)
248{ 252{
249 int ret = 0; 253 int ret = 0;
250 if (!__builtin_constant_p(size)) 254 if (!__builtin_constant_p(size))
@@ -273,7 +277,8 @@ static __always_inline int __copy_from_user(void *dst, const void __user *src, u
273 } 277 }
274} 278}
275 279
276static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 280static __always_inline __must_check
281int __copy_to_user(void __user *dst, const void *src, unsigned size)
277{ 282{
278 int ret = 0; 283 int ret = 0;
279 if (!__builtin_constant_p(size)) 284 if (!__builtin_constant_p(size))
@@ -304,7 +309,8 @@ static __always_inline int __copy_to_user(void __user *dst, const void *src, uns
304 } 309 }
305} 310}
306 311
307static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 312static __always_inline __must_check
313int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
308{ 314{
309 int ret = 0; 315 int ret = 0;
310 if (!__builtin_constant_p(size)) 316 if (!__builtin_constant_p(size))
@@ -344,15 +350,17 @@ static __always_inline int __copy_in_user(void __user *dst, const void __user *s
344 } 350 }
345} 351}
346 352
347long strncpy_from_user(char *dst, const char __user *src, long count); 353__must_check long
348long __strncpy_from_user(char *dst, const char __user *src, long count); 354strncpy_from_user(char *dst, const char __user *src, long count);
349long strnlen_user(const char __user *str, long n); 355__must_check long
350long __strnlen_user(const char __user *str, long n); 356__strncpy_from_user(char *dst, const char __user *src, long count);
351long strlen_user(const char __user *str); 357__must_check long strnlen_user(const char __user *str, long n);
352unsigned long clear_user(void __user *mem, unsigned long len); 358__must_check long __strnlen_user(const char __user *str, long n);
353unsigned long __clear_user(void __user *mem, unsigned long len); 359__must_check long strlen_user(const char __user *str);
354 360__must_check unsigned long clear_user(void __user *mem, unsigned long len);
355extern long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size); 361__must_check unsigned long __clear_user(void __user *mem, unsigned long len);
362
363__must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size);
356#define __copy_to_user_inatomic copy_user_generic 364#define __copy_to_user_inatomic copy_user_generic
357 365
358#endif /* __X86_64_UACCESS_H */ 366#endif /* __X86_64_UACCESS_H */