加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 何时忽略LD_PRELOAD

发布时间:2020-12-16 09:57:07 所属栏目:百科 来源:网络整理
导读:我正在尝试使用LD_PRELOAD来包装系统中的一些函数,我首先导出环境变量LD_PRELOAD指向我的.so文件,然后运行系统,我总是得到ERROR:ld.so:object’/ full /来自LD_PRELOAD的path / to / wrap.so’无法预加载:忽略.所以我试着在手册页上理解LD_PRELOAD: A li
我正在尝试使用LD_PRELOAD来包装系统中的一些函数,我首先导出环境变量LD_PRELOAD指向我的.so文件,然后运行系统,我总是得到ERROR:ld.so:object’/ full /来自LD_PRELOAD的path / to / wrap.so’无法预加载:忽略.所以我试着在手册页上理解LD_PRELOAD:

A list of additional,user-specified,ELF shared libraries to be loaded before all others. The items of the list can be separated by spaces or colons. This can be used to selectively override functions in other shared libraries. The libraries are searched for using the rules given under DESCRIPTION. For set-user-ID/set-group-ID ELF binaries,preload pathnames containing slashes are ignored,and libraries in the standard search directories are loaded only if the set-user-ID permission bit is enabled on the library file.

我不是100%理解上面的文字,首先,它说

For set-user-ID/set-group-ID ELF binaries,preload pathnames containing slashes are ignored

如果我不能使用斜杠,我该如何设置LA_PRELOAD的完整路径?

第二,它说

and libraries in the standard search directories are loaded only if…

什么是标准搜索目录?

我的最后一个问题是了解何时忽略LD_PRELOAD?谢谢您的帮助.

编辑:

当我将LD_PRELOAD导出到/usr/lib /中的共享库时,如下所示:export LD_PRELOAD = shared-lib.so,我摆脱了上面的错误,但是我没有root权限,所以我无法放/usr/lib /下的任何文件,有关于此的任何建议吗?我想如果我可以设法在没有任何斜杠的情况下导出LD_PRELOAD,它应该可以工作,但除非共享库文件在/usr/lib /中,否则LD_PRELOAD需要完整路径.

解决方法

您可能希望导出LD_DEBUG =文件以获得对正在发生的事情的一些了解,尽管输出将非常冗长,并且可能需要一段时间才能找到相关的行.

编辑:因为这没有帮助,您可能想尝试其他LD_DEBUG选项:

libs        display library search paths
reloc       display relocation processing
files       display progress for input file
symbols     display symbol table processing
bindings    display information about symbol binding
versions    display version dependencies
all         all previous options combined
statistics  display relocation statistics
unused      determined unused DSOs
help        display this help message and exit

所有看起来都像是一种矫枉过正,但也许libs或符号会显示出一些有用的东西.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读