strace port x32

29 views
Skip to first unread message

Mike Frysinger

unread,
Dec 7, 2011, 5:06:28 PM12/7/11
to x32...@googlegroups.com
anyone poking this ? seems like tracing x32 abi with a 64bit strace
should be easy, but tracing 64bit binaries with a x32 strace will be
hard. mostly due to the pointers in the traced process being larger
(8 bytes) than the native pointer/unsigned long types in strace (4
bytes).

would have the same problem with a 32bit x86 strace trying to trace a
64bit process ...

maybe the easy answer is that 64-bit can trace m32/m64/mx32, and an
x32-bit can only trace m32/mx32 for now ...
-mike

H.J. Lu

unread,
Dec 7, 2011, 5:21:37 PM12/7/11
to x32...@googlegroups.com

I believe so.

--
H.J.

Mike Frysinger

unread,
Dec 7, 2011, 5:51:05 PM12/7/11
to x32...@googlegroups.com
> I believe so.

so no one is currently looking at it, and we're fine with the initial
port not supporting tracing 64bit binaries from a x32 strace.
-mike

Mike Frysinger

unread,
Dec 20, 2011, 11:19:33 AM12/20/11
to x32...@googlegroups.com
this group seems to hate me when i try to use, git send-email, so
patch is attached
-mike

From: Mike Frysinger <vap...@gentoo.org>
Date: Mon, 19 Dec 2011 20:57:32 -0500
Subject: [PATCH] x86-64: use __u64 for pt_regs

The x32 userspace still has 64bit regs, so the registers have to be
declared explicitly as 64bit values rather than relying on unsigned
long being 8 bytes (which it isn't on x32).

Signed-off-by: Mike Frysinger <vap...@gentoo.org>
---
arch/x86/include/asm/ptrace.h | 42 ++++++++++++++++++++--------------------
1 files changed, 21 insertions(+), 21 deletions(-)

0001-x86-64-use-__u64-for-pt_regs.patch

Mike Frysinger

unread,
Dec 20, 2011, 7:14:17 PM12/20/11
to x32...@googlegroups.com
i've been playing with 64bit and x32 processes ptracing each other.
seems like my PTRACE_REGS is getting truncated to 32bit values. i
can't check at what level this is happening since i don't have strace,
and gdb is segfaulting on me when i descend into ptrace calls. my
next step is to add some printk's to the kernel code paths, but before
i do that, is this expected to work ? since the full 64bit reg values
are available to x32 processes, it seems like doing PTRACE_REGS should
get me a structure with all 64bit values filled out ...
-mike

Roland McGrath

unread,
Dec 20, 2011, 7:28:22 PM12/20/11
to x32...@googlegroups.com
Do you mean PTRACE_GETREGS? IMHO it would be reasonable if x32 processes
only supported PTRACE_GETREGSET (all the other variants are historical
relics now). But I haven't looked at the x32 kernel changes so as to guess
what explains what you're seeing.

H. Peter Anvin

unread,
Dec 20, 2011, 9:21:59 PM12/20/11
to x32...@googlegroups.com, Mike Frysinger
On 12/07/2011 02:51 PM, Mike Frysinger wrote:
>
> so no one is currently looking at it, and we're fine with the initial
> port not supporting tracing 64bit binaries from a x32 strace.
>

I think that's fine... in an all-x32 environment there won't be any, and
if there are 64-bit binaries involved then it should be okay to say that
you have to have a 64-bit strace; this is consistent with an i386
strace, I believe.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

Mike Frysinger

unread,
Dec 20, 2011, 10:32:40 PM12/20/11
to x32...@googlegroups.com

yeah sorry, i meant PTRACE_GETREGS. the one where you pass it struct pt_regs.

when i look at the ptrace code, there doesn't seem to be x32-specific
paths. it seems to re-use the existing x86_64 code paths. so forcing
x32 to only support PTRACE_GETREGSET would add code overhead rather
than remove it :).
-mike

Mike Frysinger

unread,
Dec 20, 2011, 10:36:30 PM12/20/11
to H. Peter Anvin, x32...@googlegroups.com
On Tue, Dec 20, 2011 at 21:21, H. Peter Anvin wrote:
> On 12/07/2011 02:51 PM, Mike Frysinger wrote:
>> so no one is currently looking at it, and we're fine with the initial
>> port not supporting tracing 64bit binaries from a x32 strace.
>
> I think that's fine... in an all-x32 environment there won't be any, and
> if there are 64-bit binaries involved then it should be okay to say that
> you have to have a 64-bit strace; this is consistent with an i386
> strace, I believe.

if you want to use x32 as your desktop, there commonly will still be a
need for either x86_64 or i386 in supplemental positions, and i
imagine people would prefer the former when possible. i wouldn't be
surprised if it flash/hulu/skype took time (if ever) to get a x32
build. i also wonder about the nvidia-drivers (i.e. hardware
accelerated OpenGL) and if it will get x32 userland support ...

not saying you're wrong or anything, just that the desktop world
carries a lot of annoying baggage for a not insignificant number of
users :(
-mike

H. Peter Anvin

unread,
Dec 20, 2011, 10:48:11 PM12/20/11
to Mike Frysinger, x32...@googlegroups.com
On 12/20/2011 07:36 PM, Mike Frysinger wrote:
>
> if you want to use x32 as your desktop, there commonly will still be a
> need for either x86_64 or i386 in supplemental positions, and i
> imagine people would prefer the former when possible. i wouldn't be
> surprised if it flash/hulu/skype took time (if ever) to get a x32
> build. i also wonder about the nvidia-drivers (i.e. hardware
> accelerated OpenGL) and if it will get x32 userland support ...
>

I'm not disagreeing, but if the x86-64 libraries are available then it
shouldn't be a problem for strace to be x86-64.

-hpa

Reply all
Reply to author
Forward
0 new messages