diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-14 19:49:35 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 00:07:40 +0100 |
commit | 9b064fc3f95a8e44e929fdf4d6037334ea03d15b (patch) | |
tree | dd1a2a6075667841f88b1ea8b62f4df2e18c3c68 /arch/x86/include | |
parent | new helper: restore_altstack() (diff) | |
download | linux-9b064fc3f95a8e44e929fdf4d6037334ea03d15b.tar.xz linux-9b064fc3f95a8e44e929fdf4d6037334ea03d15b.zip |
new helper: compat_user_stack_pointer()
Compat counterpart of current_user_stack_pointer(); for most of the biarch
architectures those two are identical, but e.g. arm64 and arm use different
registers for stack pointer...
Note that amd64 variants of current_user_stack_pointer/compat_user_stack_pointer
do *not* rely on pt_regs having been through FIXUP_TOP_OF_STACK.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/ptrace.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 19f16ebaf4fa..7e560b6daf5d 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/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 |