[lug] Reverse LD_PRELOAD?

stimits at comcast.net stimits at comcast.net
Mon Jul 9 14:43:04 MDT 2018


This works, I'm kind of testing things this way now.
 
----- Original Message -----From: Zan Lynx <zlynx at acm.org>To: lug at lug.boulder.co.usSent: Mon, 09 Jul 2018 20:38:39 -0000 (UTC)Subject: Re: [lug] Reverse LD_PRELOAD?

On 07/09/2018 02:32 PM, stimits at comcast.net wrote:> Hi,>  > I just thinking perhaps there is some simple trick to avoid or blacklist> a library for just a single application for testing in a way similar to> using LD_PRELOAD to force a given library path. So for example I have an> OpenCL library and although I do not want to remove the file for the> rest of the system I'd to do something similar to:> LD_NEVER_LOAD=/lib64/libOpenCL.so.1.0.0 ./my_application>  > Anyone here know of a convenient method to do this for just this one> application?

Your idea would only work for libraries opened with dlopen. Librarieslinked at build time would just fail to start.

I haven't tested this or anything, but maybe try ln -s /dev/null /tmp/libOpenCL.so.1.0.0 LD_LIBRARY_PATH=/tmp ./my_application

Other than that, my only other idea is to create a copy of the librarydirectory (or a snapshot, or an overlay mount) and remove the library.Then run your application in a namespace with the directory mounted inplace of /lib64.

--  Knowledge is Power -- Power Corrupts Study Hard -- Be Evil_______________________________________________Web Page: http://lug.boulder.co.usMailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lugJoin us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20180709/0ee8a25d/attachment.html>


More information about the LUG mailing list