summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/compat.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-02-19 07:56:26 -0800
committerH. Peter Anvin <hpa@zytor.com>2012-02-20 12:52:05 -0800
commitfca460f95e928bae373daa8295877b6905bc62b8 (patch)
tree96247518911543b252f4a79cfdf578001473ff3d /arch/x86/include/asm/compat.h
parent9d3897630e14b3d33bcb24a3c0fa9d60a01d3058 (diff)
x32: Handle the x32 system call flag
x32 shares most system calls with x86-64, but unfortunately some subsystem (the input subsystem is the chief offender) which require is_compat() when operating with a 32-bit userspace. The input system actually has text files in sysfs whose meaning is dependent on sizeof(long) in userspace! We could solve this by having two completely disjoint system call tables; requiring that each system call be duplicated. This patch takes a different approach: we add a flag to the system call number; this flag doesn't affect the system call dispatch but requests compat treatment from affected subsystems for the duration of the system call. The change of cmpq to cmpl is safe since it immediately follows the and. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/include/asm/compat.h')
-rw-r--r--arch/x86/include/asm/compat.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 30d737ef2a42..7938b84e4506 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -7,6 +7,7 @@
#include <linux/types.h>
#include <linux/sched.h>
#include <asm/user32.h>
+#include <asm/unistd.h>
#define COMPAT_USER_HZ 100
#define COMPAT_UTS_MACHINE "i686\0\0"
@@ -212,9 +213,17 @@ static inline void __user *arch_compat_alloc_user_space(long len)
return (void __user *)regs->sp - len;
}
-static inline int is_compat_task(void)
+static inline bool is_compat_task(void)
{
- return current_thread_info()->status & TS_COMPAT;
+#ifdef CONFIG_IA32_EMULATION
+ if (current_thread_info()->status & TS_COMPAT)
+ return true;
+#endif
+#ifdef CONFIG_X86_X32_ABI
+ if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
+ return true;
+#endif
+ return false;
}
#endif /* _ASM_X86_COMPAT_H */