https://github.com/torvalds/linux
Revision 84c6f6046c5a2189160a8f0dca8b90427bf690ea authored by Roland McGrath on 07 March 2008, 22:56:02 UTC, committed by Linus Torvalds on 08 March 2008, 03:05:58 UTC
This makes 64-bit ptrace calls setting the 64-bit orig_ax field for a
32-bit task sign-extend the low 32 bits up to 64.  This matches what a
64-bit debugger expects when tracing a 32-bit task.

This follows on my "x86_64 ia32 syscall restart fix".  This didn't
matter until that was fixed.

The debugger ignores or zeros the high half of every register slot it
sets (including the orig_rax pseudo-register) uniformly.  It expects
that the setting of the low 32 bits always has the same meaning as a
32-bit debugger setting those same 32 bits with native 32-bit
facilities.

This never arose before because the syscall restart check never
matched any -ERESTART* values due to lack of sign extension.  Before
that fix, even 32-bit ptrace setting orig_eax to -1 failed to trigger
the restart check anyway.  So this was never noticed as a regression
of 64-bit debuggers vs 32-bit debuggers on the same 64-bit kernel.

Signed-off-by: Roland McGrath <roland@redhat.com>
[ Changed to just do the sign-extension unconditionally on x86-64,
  since orig_ax is always just a small integer and doesn't need
  the full 64-bit range ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 60d5bce
History
Tip revision: 84c6f6046c5a2189160a8f0dca8b90427bf690ea authored by Roland McGrath on 07 March 2008, 22:56:02 UTC
x86_64: make ptrace always sign-extend orig_ax to 64 bits
Tip revision: 84c6f60
File Mode Size
Kconfig -rw-r--r-- 28.6 KB
Makefile -rw-r--r-- 1.1 KB
calibrate.c -rw-r--r-- 4.7 KB
do_mounts.c -rw-r--r-- 8.1 KB
do_mounts.h -rw-r--r-- 1.4 KB
do_mounts_initrd.c -rw-r--r-- 3.2 KB
do_mounts_md.c -rw-r--r-- 7.3 KB
do_mounts_rd.c -rw-r--r-- 10.0 KB
initramfs.c -rw-r--r-- 12.0 KB
main.c -rw-r--r-- 20.5 KB
noinitramfs.c -rw-r--r-- 1.4 KB
version.c -rw-r--r-- 1009 bytes

back to top