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>
This commit is contained in:
Nick Piggin
2008-09-10 13:37:17 +02:00
committed by Ingo Molnar
parent c10d38dda1
commit 3ee1afa308
7 changed files with 39 additions and 47 deletions

View File

@@ -15,9 +15,7 @@
#define __do_strncpy_from_user(dst,src,count,res) \
do { \
long __d0, __d1, __d2; \
might_sleep(); \
if (current->mm) \
might_lock_read(&current->mm->mmap_sem); \
might_fault(); \
__asm__ __volatile__( \
" testq %1,%1\n" \
" jz 2f\n" \
@@ -66,9 +64,7 @@ EXPORT_SYMBOL(strncpy_from_user);
unsigned long __clear_user(void __user *addr, unsigned long size)
{
long __d0;
might_sleep();
if (current->mm)
might_lock_read(&current->mm->mmap_sem);
might_fault();
/* no memory constraint because it doesn't change any memory gcc knows
about */
asm volatile(