> One should be able to add LD_PRELOAD to an Environment line in a > systemd unit file. But beware, from ld.so docs: > > In secure-execution mode, preload pathnames containing slashes are > ignored. Furthermore, shared objects are preloaded only from the > standard search directories and only if they have set-user-ID mode bit > enabled (which is not typical).
Those are all valid constraints and if I'm not mistaken can be controlled by a system administrator. Thanks for bringing it up. > > Another way that setting ld_preload can be hard is when the program > that needs it is started by another process that does not need it. > Like say "mount" will fork and exec "losetup". How do you set > LD_PRELOAD for just losetup without getting mount too? Modify the code > of mount to inject an environment variable? Unfortunately, for now, yes, if you know that the application that you exec is instrumented with lttng and will perform either a fork call not followed by an exec (family) call and/or close all FDs. > Make a wrapper script > named losetup that sets LD_PRELOAD and runs the real losetup binary? This is valid option. We do have a potential solution to eliminate the need of preloading the fork wrapper but we did not yet have time to work on it. As for the FD lib utility (liblttng-ust-fd) we are open to opinion on how to solve the problem and make liblttng-ust-fd obsolete. Cheers -- Jonathan Rajotte-Julien EfficiOS _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev