[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-bug
Subject:    rpctrace on a statically linked executable
From:       "Brent W. Baccala" <cosine () freesoft ! org>
Date:       2018-03-06 3:03:35
Message-ID: CADyN2Vzh5+b9O+aEjGf-UvN8DNsZoqgVsJUi5oMXv74eBrSV0Q () mail ! gmail ! com
[Download RAW message or body]

Hi -

I'm confused by rpctrace's behavior on a statically linked test program.
Here's the program:

#include <stdio.h>

int main(int argc, char *argv[])
{
  printf("Hello world!\n");
}

Perhaps you've seen it before :-)

When I compile the program with -static, I get an executable that works
fine, but can't be traced:

root@qemu-hurd:~# rpctrace ./hello-world
task134(pid8538)->vm_statistics () = 0 {4096 462739 56607 206740 23868
12642497 0 424184 481063 142824515 37245163 15804468 15747574}
Child 8538 Killed

A little more digging shows that the program is receiving an exception
after the vm_statistics call.  It happens very early, before the C library
has set up an exception handler, so the exception goes to rpctrace itself,
but some code fiddling inside rpctrace shows it:

root@qemu-hurd:~# ./rpctrace ./hello-world
135(task134)-->134(task-1)->vm_statistics () = 0 {4096 462739 56536 206804
23868 12643374 0 424194 481436 142836984 37247781 15804960 15748056}
136(task-1)-->121(task1)->exception_raise (   142<--144(pid8561)
134<--145(pid8561) 1 2 20) = 0x40000001 (Operation not permitted)
Child 8562 Killed

I'm stumped.  Any idea why tracing a statically linked program will throw
an exception so early, and only when being traced?

    agape
    brent

[Attachment #3 (text/html)]

<div dir="ltr">Hi -<div><br></div><div>I&#39;m confused by rpctrace&#39;s behavior on \
a statically linked test program.   Here&#39;s the \
program:</div><div><br></div><div><div><div><font face="monospace, \
monospace">#include &lt;stdio.h&gt;</font></div><div><font face="monospace, \
monospace"><br></font></div><div><font face="monospace, monospace">int main(int argc, \
char *argv[])</font></div><div><font face="monospace, \
monospace">{</font></div><div><font face="monospace, monospace">   printf(&quot;Hello \
world!\n&quot;);</font></div><div><font face="monospace, \
monospace">}</font></div></div></div><div><br></div><div>Perhaps you&#39;ve seen it \
before :-)</div><div><br></div><div>When I compile the program with <font \
face="monospace, monospace">-static</font>, I get an executable that works fine, but \
can&#39;t be traced:</div><div><br></div><div><div><font face="monospace, \
monospace">root@qemu-hurd:~# rpctrace ./hello-world</font></div><div><font \
face="monospace, monospace">task134(pid8538)-&gt;vm_statistics () = 0 {4096 462739 \
56607 206740 23868 12642497 0 424184 481063 142824515 37245163 15804468 \
15747574}</font></div><div><font face="monospace, monospace">Child 8538 \
Killed</font></div></div><div><br></div><div>A little more digging shows that the \
program is receiving an exception after the vm_statistics call.   It happens very \
early, before the C library has set up an exception handler, so the exception goes to \
rpctrace itself, but some code fiddling inside rpctrace shows \
it:</div><div><br></div><div><div><font face="monospace, monospace">root@qemu-hurd:~# \
./rpctrace ./hello-world</font></div><div><font face="monospace, \
monospace">135(task134)--&gt;134(task-1)-&gt;vm_statistics () = 0 {4096 462739 56536 \
206804 23868 12643374 0 424194 481436 142836984 37247781 15804960 \
15748056}</font></div><div><font face="monospace, \
monospace">136(task-1)--&gt;121(task1)-&gt;exception_raise (     \
142&lt;--144(pid8561)      134&lt;--145(pid8561) 1 2 20) = 0x40000001 (Operation not \
permitted)  </font></div><div><font face="monospace, monospace">Child 8562 \
Killed</font></div></div><div><br></div><div>I&#39;m stumped.   Any idea why tracing \
a statically linked program will throw an exception so early, and only when being \
traced?</div><div><br></div><div>      agape</div><div>      \
brent</div><div><br></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic