tmp_suning_uos_patched/arch/x86/ia32
Chuck Ebbert ecd744eec3 x86 - 32-bit ptrace emulation mishandles 6th arg
[ jdike - Pushing Chuck's patch - see
http://lkml.org/lkml/2005/9/16/261 for some history and a test
program.  UML is also broken without this patch - its processes get
SIGBUS from the corrupt 6th argument to mmap being interpretted as a
file offset ]

When the 32-bit vDSO is used to make a system call, the %ebp register for
the 6th syscall arg has to be loaded from the user stack (where it's pushed
by the vDSO user code).  The native i386 kernel always does this before
stopping for syscall tracing, so %ebp can be seen and modified via ptrace
to access the 6th syscall argument.  The x86-64 kernel fails to do this,
presenting the stack address to ptrace instead.  This makes the %rbp value
seen by 64-bit ptrace of a 32-bit process, and the %ebp value seen by a
32-bit caller of ptrace, both differ from the native i386 behavior.

This patch fixes the problem by putting the word loaded from the user stack
into %rbp before calling syscall_trace_enter, and reloading the 6th syscall
argument from there afterwards (so ptrace can change it).  This makes the
behavior match that of i386 kernels.

Original-Patch-By: Roland McGrath <roland@redhat.com>

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2007-11-10 04:30:36 +01:00
..
audit.c i386/x86_64: move headers to include/asm-x86 2007-10-11 11:20:03 +02:00
fpu32.c x86_64: move ia32 2007-10-11 11:17:21 +02:00
ia32_aout.c x86: initialize 64bit registers for a.out executables 2007-10-17 20:15:30 +02:00
ia32_binfmt.c x86: Use linux/elfcore-compat.h 2007-10-19 20:35:02 +02:00
ia32_signal.c x86_64: move ia32 2007-10-11 11:17:21 +02:00
ia32entry.S x86 - 32-bit ptrace emulation mishandles 6th arg 2007-11-10 04:30:36 +01:00
ipc32.c remove include/asm-*/ipc.h 2007-10-17 08:42:55 -07:00
Makefile x86_64: install unstripped copies of compat vdso on disk 2007-10-17 20:15:18 +02:00
mmap32.c x86_64: move ia32 2007-10-11 11:17:21 +02:00
ptrace32.c x86_64: ia32 ptrace THREAD_AREA fix 2007-11-10 04:30:36 +01:00
sys_ia32.c x86_64: move ia32 2007-10-11 11:17:21 +02:00
syscall32_syscall.S x86_64: move ia32 2007-10-11 11:17:21 +02:00
syscall32.c x86_64: move ia32 2007-10-11 11:17:21 +02:00
tls32.c x86_64: move ia32 2007-10-11 11:17:21 +02:00
vsyscall-sigreturn.S x86_64: move ia32 2007-10-11 11:17:21 +02:00
vsyscall-syscall.S x86_64: move ia32 2007-10-11 11:17:21 +02:00
vsyscall-sysenter.S x86_64: move ia32 2007-10-11 11:17:21 +02:00
vsyscall.lds x86_64: move ia32 2007-10-11 11:17:21 +02:00