problem with running a direct command

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with running a direct command

corpaul
I'm having the following issue with Systemtap:

When I probe a specific application with the following command:
~/systemtap/stap/bin/stap ~/systemtap/probes/logIOWrites.stp -DMAXMAPENTRIES=10000 -DSTP_NO_OVERLOAD -DMAXSTRINGLEN=4096 -DTRYLOCKDELAY=300 -DMAXSKIPPED=10000 -DMAXACTION=1000 -c'./tribler.sh'

The application gives me an error:
Traceback (most recent call last):
  File "Tribler/Main/tribler.py", line 28, in <module>
    from Tribler.Core.Libtorrent.LibtorrentMgr import LibtorrentMgr
  File "/home/user/src/tribler/Tribler/Core/Libtorrent/LibtorrentMgr.py", line 6, in <module>
    import libtorrent as lt
ImportError: libboost_python-py27.so.1.49.0: cannot open shared object file: No such file or directory

However, when I start the probe without the direct command and start ./tribler.sh in another terminal, the probe and application work fine. Does Systemtap make a change in the LD_LIBRARY_PATH or something?

--CP
Reply | Threaded
Open this post in threaded view
|

Re: problem with running a direct command

Josh Stone-5
On 05/14/2013 05:57 AM, corpaul wrote:
> Does Systemtap make a change in the LD_LIBRARY_PATH or something?

Yes, this is a consequence of going through our staprun loader, which is
a setuid executable.  LD_LIBRARY_PATH, LD_PRELOAD, and several others
are removed and ignored from all setuid/setgid executables for security
reasons.

We could possibly backup these variables somehow, and restore them after
we've dropped privileges, but I'm always hesitant to mess with
security-sensitive code.

Since you're already using a script, tribler.sh, can you set the
relevant environment in there?  Or another option is to set this in the
command invocation, like:

  stap .... -c "env 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH' ./tribler.sh"

Note the double-quotes to let it expand early, and single-quotes to
preserve any spacing when it runs.
Reply | Threaded
Open this post in threaded view
|

RE: problem with running a direct command

corpaul
Works excellent, thanks!

--CP
________________________________________
From: Josh Stone [[hidden email]]
Sent: Tuesday, May 14, 2013 6:52 PM
To: Cor-paul Bezemer - EWI
Cc: [hidden email]
Subject: Re: problem with running a direct command

On 05/14/2013 05:57 AM, corpaul wrote:
> Does Systemtap make a change in the LD_LIBRARY_PATH or something?

Yes, this is a consequence of going through our staprun loader, which is
a setuid executable.  LD_LIBRARY_PATH, LD_PRELOAD, and several others
are removed and ignored from all setuid/setgid executables for security
reasons.

We could possibly backup these variables somehow, and restore them after
we've dropped privileges, but I'm always hesitant to mess with
security-sensitive code.

Since you're already using a script, tribler.sh, can you set the
relevant environment in there?  Or another option is to set this in the
command invocation, like:

  stap .... -c "env 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH' ./tribler.sh"

Note the double-quotes to let it expand early, and single-quotes to
preserve any spacing when it runs.