x86: some lock annotations for user copy paths, v3
authorIngo Molnar <mingo@elte.hu>
Thu, 11 Sep 2008 18:53:21 +0000 (20:53 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 11 Sep 2008 19:42:59 +0000 (21:42 +0200)
- add annotation back to clear_user()
- change probe_kernel_address() to _inatomic*() method

Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/lib/usercopy_32.c
include/asm-x86/uaccess.h
include/linux/uaccess.h

index 7393152a252e74bf0992993e7d3ac58b887de763..fab5faba1d3e5ff4d4f1778a3692d0a51c4475fc 100644 (file)
@@ -148,6 +148,7 @@ do {                                                                        \
 unsigned long
 clear_user(void __user *to, unsigned long n)
 {
+       might_fault();
        if (access_ok(VERIFY_WRITE, to, n))
                __do_clear_user(to, n);
        return n;
index 39f8420c75d922fea19988ec055e0aa4295bef99..dc8edb5c46593dad80aa46618e9e8fa3ff296152 100644 (file)
@@ -267,7 +267,6 @@ extern void __put_user_8(void);
 #define __put_user_size(x, ptr, size, retval, errret)                  \
 do {                                                                   \
        retval = 0;                                                     \
-       might_fault();                                                  \
        __chk_user_ptr(ptr);                                            \
        switch (size) {                                                 \
        case 1:                                                         \
@@ -320,7 +319,6 @@ do {                                                                        \
 #define __get_user_size(x, ptr, size, retval, errret)                  \
 do {                                                                   \
        retval = 0;                                                     \
-       might_fault();                                                  \
        __chk_user_ptr(ptr);                                            \
        switch (size) {                                                 \
        case 1:                                                         \
index fec6decfb983503ec8ae24bafa793f09b5f902b2..2062293e57e6a26b2289211585dcf39c900e71c1 100644 (file)
@@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to,
                                                        \
                set_fs(KERNEL_DS);                      \
                pagefault_disable();                    \
-               ret = __get_user(retval, (__force typeof(retval) __user *)(addr));              \
+               ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval));            \
                pagefault_enable();                     \
                set_fs(old_fs);                         \
                ret;                                    \