<div dir="ltr"><div>Hello,</div><div><br></div><div>Thank you everyone for the assistance and quick response. Thankfully adding the Environment with LD_PRELOAD in the systemd service file was enough to get everything running smoothly. <br></div><div><br></div><div>Regards,</div><div>Mosleh</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 3:06 PM Jonathan Rajotte-Julien <<a href="mailto:jonathan.rajotte-julien@efficios.com">jonathan.rajotte-julien@efficios.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> One should be able to add LD_PRELOAD to an Environment line in a<br>
> systemd unit file.  But beware, from ld.so docs:<br>
> <br>
> In secure-execution mode, preload pathnames containing slashes are<br>
> ignored.  Furthermore, shared objects are preloaded only from the<br>
> standard search directories and only if they have set-user-ID mode bit<br>
> enabled (which is not typical).<br>
<br>
Those are all valid constraints and if I'm not mistaken can be controlled by a<br>
system administrator. Thanks for bringing it up.<br>
<br>
> <br>
> Another way that setting ld_preload can be hard is when the program<br>
> that needs it is started by another process that does not need it. <br>
> Like say "mount" will fork and exec "losetup".  How do you set<br>
> LD_PRELOAD for just losetup without getting mount too?  Modify the code<br>
> of mount to inject an environment variable?<br>
<br>
Unfortunately, for now, yes, if you know that the application that you exec is<br>
instrumented with lttng and will perform either a fork call not followed by an<br>
exec (family) call and/or close all FDs.<br>
<br>
> Make a wrapper script<br>
> named losetup that sets LD_PRELOAD and runs the real losetup binary?<br>
<br>
This is valid option.<br>
<br>
We do have a potential solution to eliminate the need of preloading the fork<br>
wrapper but we did not yet have time to work on it.<br>
<br>
As for the FD lib utility (liblttng-ust-fd) we are open to opinion on how to<br>
solve the problem and make liblttng-ust-fd obsolete.<br>
<br>
Cheers<br>
-- <br>
Jonathan Rajotte-Julien<br>
EfficiOS<br>
</blockquote></div>