Re: [PATCH] x86-64: ptrace ia32 BP fix

From: Daniel Jacobowitz
Date: Tue Jul 05 2005 - 09:30:03 EST


On Tue, Jul 05, 2005 at 02:31:15AM -0700, Roland McGrath wrote:
>
> 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.

Wouldn't this to botch a debugger which supported both backtracing and
PTRACE_SYSCALL, when stopped in a syscall? We have unwind information
for the VDSO and it's not going to tell us that the kernel has done
something clever to the value of %ebp.


--
Daniel Jacobowitz
CodeSourcery, LLC
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/