linux-next: manual merge of the uprobes tree with the tip tree

From: Stephen Rothwell
Date: Tue Mar 13 2012 - 01:53:03 EST


Hi Srikar,

Today's linux-next merge of the uprobes tree got a conflict in
arch/x86/include/asm/compat.h between commits fca460f95e92 ("x32: Handle
the x32 system call flag") and a628b684d27d ("x32: Provide separate
is_ia32_task() and is_x32_task() predicates") from the tip tree and
commit 1e1e2cddc33d ("x86/trivial: use is_ia32_compat_task") from the
uprobes tree.

I fixed it up (see below) and can carry the fix as necessary.
--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc arch/x86/include/asm/compat.h
index 355edc0,a6ba59d..0000000
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@@ -223,39 -214,15 +229,41 @@@ static inline compat_uptr_t ptr_to_comp

static inline void __user *arch_compat_alloc_user_space(long len)
{
- struct pt_regs *regs = task_pt_regs(current);
- return (void __user *)regs->sp - len;
+ compat_uptr_t sp;
+
+ if (test_thread_flag(TIF_IA32)) {
+ sp = task_pt_regs(current)->sp;
+ } else {
+ /* -128 for the x32 ABI redzone */
+ sp = percpu_read(old_rsp) - 128;
+ }
+
+ return (void __user *)round_down(sp - len, 16);
+}
+
+static inline bool is_ia32_task(void)
+{
+#ifdef CONFIG_IA32_EMULATION
+ if (current_thread_info()->status & TS_COMPAT)
+ return true;
+#endif
+ return false;
+}
+
+static inline bool is_x32_task(void)
+{
+#ifdef CONFIG_X86_X32_ABI
+ if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
+ return true;
+#endif
+ return false;
}

+ #undef is_compat_task
+
-static inline int is_compat_task(void)
+static inline bool is_compat_task(void)
{
- return current_thread_info()->status & TS_COMPAT;
+ return is_ia32_task() || is_x32_task();
}

#endif /* _ASM_X86_COMPAT_H */

Attachment: pgp00000.pgp
Description: PGP signature