From 53edf2c645fad76fe3b187b9a269c8ab70a6722c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 14 Dec 2012 13:49:35 -0500 Subject: [PATCH] --- yaml --- r: 347781 b: refs/heads/master c: 9b064fc3f95a8e44e929fdf4d6037334ea03d15b h: refs/heads/master i: 347779: 9b65f150d828998a341f4eff35d6d5d86d144409 v: v3 --- [refs] | 2 +- trunk/arch/arm64/include/asm/compat.h | 5 +++-- trunk/arch/x86/include/asm/ptrace.h | 7 +++++++ trunk/include/linux/compat.h | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 43d49752e874..8f2cee69eb69 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5c49574ffd7ac07eae8c3b065d19e6ebc7e4760f +refs/heads/master: 9b064fc3f95a8e44e929fdf4d6037334ea03d15b diff --git a/trunk/arch/arm64/include/asm/compat.h b/trunk/arch/arm64/include/asm/compat.h index 37e610dc084e..d9ec40217a27 100644 --- a/trunk/arch/arm64/include/asm/compat.h +++ b/trunk/arch/arm64/include/asm/compat.h @@ -209,10 +209,11 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) return (u32)(unsigned long)uptr; } +#define compat_user_stack_pointer() (current_pt_regs()->compat_sp) + static inline void __user *arch_compat_alloc_user_space(long len) { - struct pt_regs *regs = task_pt_regs(current); - return (void __user *)regs->compat_sp - len; + return (void __user *)compat_user_stack_pointer() - len; } struct compat_ipc64_perm { diff --git a/trunk/arch/x86/include/asm/ptrace.h b/trunk/arch/x86/include/asm/ptrace.h index 19f16ebaf4fa..7e560b6daf5d 100644 --- a/trunk/arch/x86/include/asm/ptrace.h +++ b/trunk/arch/x86/include/asm/ptrace.h @@ -203,6 +203,13 @@ static inline bool user_64bit_mode(struct pt_regs *regs) return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs; #endif } + +#define current_user_stack_pointer() this_cpu_read(old_rsp) +/* ia32 vs. x32 difference */ +#define compat_user_stack_pointer() \ + (test_thread_flag(TIF_IA32) \ + ? current_pt_regs()->sp \ + : this_cpu_read(old_rsp)) #endif #ifdef CONFIG_X86_32 diff --git a/trunk/include/linux/compat.h b/trunk/include/linux/compat.h index a7877fa809fd..62bb76f91baf 100644 --- a/trunk/include/linux/compat.h +++ b/trunk/include/linux/compat.h @@ -65,6 +65,9 @@ #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ +#ifndef compat_user_stack_pointer +#define compat_user_stack_pointer() current_user_stack_pointer() +#endif #define compat_jiffies_to_clock_t(x) \ (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)