linux_dsm_epyc7002/arch/x86
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
..
boot x86 setup: set %ebx == %ebp == %edi == 0 on protected mode entry 2007-11-04 19:48:04 -08:00
configs x86 gart: rename CONFIG_IOMMU to CONFIG_GART_IOMMU 2007-10-30 00:22:22 +01:00
crypto x86: merge arch/x86/crypto Makefiles 2007-10-23 22:37:23 +02:00
ia32 x86 - 32-bit ptrace emulation mishandles 6th arg 2007-11-10 04:30:36 +01:00
kernel x86: make nmi_cpu_busy() always defined 2007-11-09 22:39:38 +01:00
lguest lguest: tidy up documentation 2007-11-05 21:55:57 +11:00
lib Merge ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86 2007-10-19 15:06:00 -07:00
mach-default spelling fixes: arch/i386/ 2007-10-20 01:13:56 +02:00
mach-es7000 i386: es7000 minor cleanups 2007-10-17 20:16:15 +02:00
mach-generic spelling fixes: arch/i386/ 2007-10-20 01:13:56 +02:00
mach-visws [x86] remove uses of magic macros for boot_params access 2007-10-16 17:38:31 -07:00
mach-voyager x86: voyager: fix bogus conversion to per_cpu for boot_cpu_info 2007-10-27 20:57:43 +02:00
math-emu kbuild: fix up CFLAGS usage 2007-10-14 21:49:42 +02:00
mm Merge branch 'v2.6.24-rc1-lockdep' of git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep 2007-11-03 12:42:52 -07:00
oprofile x86: add instrumentation menu 2007-10-23 22:37:22 +02:00
pci spelling fixes: arch/i386/ 2007-10-20 01:13:56 +02:00
power i386: move power 2007-10-11 11:16:34 +02:00
vdso x86: vdso linker script cleanup 2007-10-17 20:17:06 +02:00
video i386: move video 2007-10-11 11:16:56 +02:00
xen [SPARC, XEN, NET/CXGB3] use irq_handler_t where appropriate 2007-10-23 19:53:17 -04:00
Kconfig.cpu x86: move i386 and x86_64 Kconfig files to x86 directory 2007-10-25 22:37:02 +02:00
Kconfig.debug remove the dead X86_REMOTE_DEBUG option 2007-10-30 00:22:22 +01:00
Kconfig.i386 x86: move i386 and x86_64 Kconfig files to x86 directory 2007-10-25 22:37:02 +02:00
Kconfig.x86_64 Remove bogus default y for DMAR and NET_DMA 2007-10-30 08:06:55 -07:00
Makefile x86: move defconfig files for i386 and x86_64 to x86 2007-10-25 22:27:41 +02:00
Makefile_32 x86: move i386 and x86_64 Makefiles to arch/x86 2007-10-25 22:27:34 +02:00
Makefile_32.cpu x86: move i386 and x86_64 Makefiles to arch/x86 2007-10-25 22:27:34 +02:00
Makefile_64 x86: move i386 and x86_64 Makefiles to arch/x86 2007-10-25 22:27:34 +02:00