On Fri, Sep 19, 2008 at 9:44 AM, Alfred Peng <[EMAIL PROTECTED]> wrote:
> bash-3.2$ env -i PATH=$PATH songbird --version
> POTI, Inc. Songbird 0.7.0, Copyright(c) 2005-2008 POTI, Inc.
> Segmentation Fault (core dumped)
> bash-3.2$ pargs -ae core
> core 'core' of 3606: songbird --version
> argv[0]: songbird
> argv[1]: <NULL>
>
> envp[0]: <0xfe38aea9>
> envp[1]: PATH=/usr/bin:/usr/openwin/bin:/usr/ucb
As I suspected, kinda. I have never seen pargs print an address -
presumably to an address that is outside of its address space. ("pmap
-x core" may help confirm)
I think that there is a bug in Songbird that is being exposed by the
dtrace probes. It would probably be most fruitful to take this up the
Songbird developers.
I still think that it would be a good idea for dtri.o to not read
environment variables after the application has had a chance to mess
with the environment. Even if this is fixed, existing applications
would need to be relinked with the new drti.o to see the fix. I have
filed a bug report - perhaps someone at Sun can post the bug ID to the
list as I will not see it until someone at Sun starts to update it.
Here's the reproducible test case I included in the bug report
(special thanks to Alan,
http://blogs.sun.com/tpenta/entry/dtrace_using_placing_sdt_probes).
=== hello.c ===
#include <stdio.h>
#include <unistd.h>
#include <sys/sdt.h>
int
main(int argc, char **argv, char **envp) {
DTRACE_PROBE(world, loop);
if ( argc != 1 ) {
envp[0] = 0xff;
}
printf("Hello World\n");
}
================
=== myserv.d ===
provider world {
probe loop();
};
#pragma D attributes Evolving/Evolving/Common provider world provider
#pragma D attributes Private/Private/Common provider world module
#pragma D attributes Private/Private/Common provider world function
#pragma D attributes Evolving/Evolving/Common provider world name
#pragma D attributes Evolving/Evolving/Common provider world args
================
$ cc -c hello.c
$ dtrace -32 -G -s myserv.d hello.o
$ cc -o hello -ldtrace myserv.o hello.o
$ ./hello
$ ./hello a
Hello World
Segmentation Fault (core dumped)
$ pstack core
core 'core' of 2025: ./hello a
d1a0608b findenv (8047810, 80515e4, 1, 8047764) + 54
d1a06533 getenv (80515e4) + 31
08050fbf dprintf (1, 8051430, 0) + 27
080512fc dtrace_dof_fini (d1b01000, 80477d8, d19fffa4, 80478d0,
80477c0, d1b01000) + 58
08051406 _fini (80478d0, 80477c0, d1b01000, d1bfee58, 10, 8050e46) + 26
d19fffa4 _exithandle (d1bfc7dc, 8050e46, c, c, 8050dde, 80513e0) + 53
d19f2802 exit (2, 8047938, 8047940, 0, ff, 8047a1c) + 12
$ env -i FOO=foo BAR=bar ./hello a
Hello World
Segmentation Fault (core dumped)
$ pstack core
core 'core' of 2056: ./hello a
d1a0608b findenv (8047f60, 80515e4, 1, 8047eb4) + 54
d1a06533 getenv (80515e4) + 31
08050fbf dprintf (1, 8051430, 0) + 27
080512fc dtrace_dof_fini (d1b01000, 8047f28, d19fffa4, 8047f6c,
8047f10, d1b01000) + 58
08051406 _fini (8047f6c, 8047f10, d1b01000, d1bfee58, 10, 8050e46) + 26
d19fffa4 _exithandle (d1bfc7dc, 8050e46, c, c, 8050dde, 80513e0) + 53
d19f2802 exit (2, 8047fd4, 8047fdc, 0, ff, 8047fe6) + 12
$ pargs -e core
core 'core' of 2056: ./hello a
envp[0]: <0x000000ff>
envp[1]: FOO=foo
--
Mike Gerdts
http://mgerdts.blogspot.com/
_______________________________________________
dtrace-discuss mailing list
[email protected]