path: root/arch/x86/include/asm/uaccess.h
diff options
authorAndy Lutomirski <>2011-11-07 16:33:40 -0800
committerIngo Molnar <>2011-12-05 12:17:27 +0100
commit4fc3490114bb159bd4fff1b3c96f4320fe6fb08f (patch)
tree71941c92c7352b1b78c169020946fecf1eae8f4a /arch/x86/include/asm/uaccess.h
parent01acc269083015e2f78407f59dc8d6378fce22ee (diff)
x86-64: Set siginfo and context on vsyscall emulation faults
To make this work, we teach the page fault handler how to send signals on failed uaccess. This only works for user addresses (kernel addresses will never hit the page fault handler in the first place), so we need to generate signals for those separately. This gets the tricky case right: if the user buffer spans multiple pages and only the second page is invalid, we set cr2 and si_addr correctly. UML relies on this behavior to "fault in" pages as needed. We steal a bit from thread_info.uaccess_err to enable this. Before this change, uaccess_err was a 32-bit boolean value. This fixes issues with UML when vsyscall=emulate. Reported-by: Adrian Bunk <> Signed-off-by: Andy Lutomirski <> Cc: richard -rw- weinberger <> Cc: H. Peter Anvin <> Cc: Linus Torvalds <> Link: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'arch/x86/include/asm/uaccess.h')
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 36361bf6fdd1..8be5f54d9360 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -462,7 +462,7 @@ struct __large_struct { unsigned long buf[100]; };
#define uaccess_catch(err) \
- (err) |= current_thread_info()->uaccess_err; \
+ (err) |= (current_thread_info()->uaccess_err ? -EFAULT : 0); \
current_thread_info()->uaccess_err = prev_err; \
} while (0)