diff options
author | Nick Piggin <npiggin@suse.de> | 2008-09-10 07:37:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-11 03:44:21 -0400 |
commit | 3ee1afa308f2a38e5d1e2ad3752ad7abcf480da1 (patch) | |
tree | 914e0f3bbd32a387cf6095c6955369fa8da7ebf6 /include/asm-x86/uaccess.h | |
parent | c10d38dda1774ed4540380333cabd229eff37094 (diff) |
x86: some lock annotations for user copy paths, v2
- introduce might_fault()
- handle the atomic user copy paths correctly
[ mingo@elte.hu: move might_sleep() outside of in_atomic(). ]
Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/uaccess.h')
-rw-r--r-- | include/asm-x86/uaccess.h | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/include/asm-x86/uaccess.h b/include/asm-x86/uaccess.h index ad29752a1713..39f8420c75d9 100644 --- a/include/asm-x86/uaccess.h +++ b/include/asm-x86/uaccess.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #include <linux/thread_info.h> | 8 | #include <linux/thread_info.h> |
9 | #include <linux/prefetch.h> | 9 | #include <linux/prefetch.h> |
10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
11 | #include <linux/lockdep.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <asm/asm.h> | 11 | #include <asm/asm.h> |
14 | #include <asm/page.h> | 12 | #include <asm/page.h> |
15 | 13 | ||
@@ -159,9 +157,7 @@ extern int __get_user_bad(void); | |||
159 | int __ret_gu; \ | 157 | int __ret_gu; \ |
160 | unsigned long __val_gu; \ | 158 | unsigned long __val_gu; \ |
161 | __chk_user_ptr(ptr); \ | 159 | __chk_user_ptr(ptr); \ |
162 | might_sleep(); \ | 160 | might_fault(); \ |
163 | if (current->mm) \ | ||
164 | might_lock_read(¤t->mm->mmap_sem); \ | ||
165 | switch (sizeof(*(ptr))) { \ | 161 | switch (sizeof(*(ptr))) { \ |
166 | case 1: \ | 162 | case 1: \ |
167 | __get_user_x(1, __ret_gu, __val_gu, ptr); \ | 163 | __get_user_x(1, __ret_gu, __val_gu, ptr); \ |
@@ -246,9 +242,7 @@ extern void __put_user_8(void); | |||
246 | int __ret_pu; \ | 242 | int __ret_pu; \ |
247 | __typeof__(*(ptr)) __pu_val; \ | 243 | __typeof__(*(ptr)) __pu_val; \ |
248 | __chk_user_ptr(ptr); \ | 244 | __chk_user_ptr(ptr); \ |
249 | might_sleep(); \ | 245 | might_fault(); \ |
250 | if (current->mm) \ | ||
251 | might_lock_read(¤t->mm->mmap_sem); \ | ||
252 | __pu_val = x; \ | 246 | __pu_val = x; \ |
253 | switch (sizeof(*(ptr))) { \ | 247 | switch (sizeof(*(ptr))) { \ |
254 | case 1: \ | 248 | case 1: \ |
@@ -273,9 +267,7 @@ extern void __put_user_8(void); | |||
273 | #define __put_user_size(x, ptr, size, retval, errret) \ | 267 | #define __put_user_size(x, ptr, size, retval, errret) \ |
274 | do { \ | 268 | do { \ |
275 | retval = 0; \ | 269 | retval = 0; \ |
276 | might_sleep(); \ | 270 | might_fault(); \ |
277 | if (current->mm) \ | ||
278 | might_lock_read(¤t->mm->mmap_sem); \ | ||
279 | __chk_user_ptr(ptr); \ | 271 | __chk_user_ptr(ptr); \ |
280 | switch (size) { \ | 272 | switch (size) { \ |
281 | case 1: \ | 273 | case 1: \ |
@@ -328,9 +320,7 @@ do { \ | |||
328 | #define __get_user_size(x, ptr, size, retval, errret) \ | 320 | #define __get_user_size(x, ptr, size, retval, errret) \ |
329 | do { \ | 321 | do { \ |
330 | retval = 0; \ | 322 | retval = 0; \ |
331 | might_sleep(); \ | 323 | might_fault(); \ |
332 | if (current->mm) \ | ||
333 | might_lock_read(¤t->mm->mmap_sem); \ | ||
334 | __chk_user_ptr(ptr); \ | 324 | __chk_user_ptr(ptr); \ |
335 | switch (size) { \ | 325 | switch (size) { \ |
336 | case 1: \ | 326 | case 1: \ |