PATCH: Add ia32 support to x32 strace

H.J. Lu hjl.tools at gmail.com
Wed Apr 18 00:03:20 UTC 2012


On Tue, Apr 17, 2012 at 4:58 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Tue, Apr 17, 2012 at 11:05:04AM -0700, H.J. Lu wrote:
>> Hi,
>>
>> This patch adds ia32 support to x32 strace.  Tested on Linux/x32.
> [...]
>> @@ -868,15 +874,14 @@ get_scno(struct tcb *tcp)
>>       }
>>  # endif
>>  # ifdef X32
>> -     if (currpers == 0 || currpers == 1) {
>> -             fprintf(stderr, "syscall_%lu (...) in unsupported %s "
>> -                     "mode of process PID=%d\n", scno,
>> -                     currpers == 0 ? "64-bit" : "32-bit", tcp->pid);
>> +     if (currpers == 0) {
>> +             fprintf(stderr, "syscall_%lu (...) in unsupported 64-bit "
>> +                     "mode of process PID=%d\n", scno, tcp->pid);
>>               return 0;
>>       }
>> -# else
>> -     update_personality(tcp, currpers);
>> +     else if (currpers == 1)
>>  # endif
>> +     update_personality(tcp, currpers);
>>  #elif defined(IA64)
>>  #    define IA64_PSR_IS      ((long)1 << 34)
>>       if (upeek(tcp, PT_CR_IPSR, &psr) >= 0)
>
> This part of the change seems to be wrong: if strace supports two personalities
> on X32, it should be able to switch to any of them, not just to
> currpers == 1.  Looks like additional currpers translation is needed for
> the X32 case.

currpers is set the same value for both x32 and x86-64 strace,

0: x86-64
1: ia32
2. x32

For x32 strace, when currpers == 1, we call update_personality to update
personality.  When currpers == 2, we do nothing since the current
personality is x32.

-- 
H.J.




More information about the Strace-devel mailing list