On 12/07, caiq...@redhat.com wrote:
>
> > Ananth, could you please confirm once again that step-jump-cont (from
> > ptrace-tests testsuite) not fail on your machine? If yes, please tell
> > me the version of glibc/gcc. Is PTRACE_GETREGS defined on your
> > machine?
>
> Funny enough. The above failure only seen on that particular system so far.
> In fact, different PPC64 systems have different results there (roland's git
> tree + your lockless patch).

Great! thanks.

OK, I seem to understand what happens, but I can not explain WHY does
this happen on that machine.

Once again. The tracer changes the tracee's instruction pointer to
the adrress of raise_sigusr2(), and resumes the tracee. The tracee
gets SIGSEGV right after that.

But. &raise_sigusr2 is not equal to the "actual" address of &raise_sigusr2(),
this value points to the "thunk" (I do not know the correct English term)
which contains the "actual" address:

        (gdb) disassemble 0x100118c0
        Dump of assembler code for function raise_sigusr2:
        0x00000000100118c0 <raise_sigusr2+0>:   .long 0x0               <---- 
SIGSEGV
        0x00000000100118c4 <raise_sigusr2+4>:   .long 0x10000ab0        <---- 
aof raise_sigusr2()
        0x00000000100118c8 <raise_sigusr2+8>:   .long 0x0

And!!! this thunk does NOT live in .text, and vma does NOT have
VM_EXEC bit!

        # cat /proc/30494/maps
        00100000-00120000 r-xp 00000000 00:00 0                                 
 [vdso]
        10000000-10010000 r-xp 00000000 fd:00 59262                             
 /root/TST/sjc
        10010000-10020000 rw-p 00000000 fd:00 59262                             
 /root/TST/sjc

That is why the tracee gets SIGSEGV, and this is correct.


Cai, perhaps you could give me access to another ppc machine where
this test does not fail?

Or, could you please run the trivial program below on that machine?

Oleg.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void my_func(void)
{
}

int main(void)
{
        char cmd[128];

        printf("ptr: %p\n", my_func);

        sprintf(cmd, "cat /proc/%d/maps", getpid());
        system(cmd);

        return 0;
}

Reply via email to