ERROR: ld.so: object 'libXXX32.so' from LD_PRELOAD cannot be preloaded: ignored.

时间:2022-02-26 15:29:21

在 x86_64 版本的 centos 5.x 运行 32 bit 的某程序,该程序需要利用 LD_PRELOAD 预先加载 libXXX32.so,也是 32 bit 的版本。

但是每次运行的时候,都会出现上面的提示,让我以为预先加载失败。

google 了一把,发现这个链接 ld.so too verbose when it can't LD_PRELOAD a 32 bit library on a 64 bit OS https://bugzilla.redhat.com/show_bug.cgi?id=249256

 

按照上面的说法,只要按照下面的步骤就可以重现这个问题

Description of problem:

If I set LD_PRELOAD to point to a 32 bit shared object when running a 32 bit
application on a 64 bit OS, ld.so (/lib64/ld-2.3.4.so) can report:

ERROR: ld.so: object '/path/to/some.so' from LD_PRELOAD cannot be preloaded:
ignored.

This can happen if the 32 bit application spawns a sub-process using the
system() call - because this calls /bin/sh which is a 64 bit binary (which
reports the 'ERROR') ...

Version-Release number of selected component (if applicable):

glibc-2.3.4-2.25

How reproducible:

Every time

Steps to Reproduce:
1. Set LD_PRELOAD to point to a 32 bit lib (on 64 bit OS)
2. Run 32 bit application that calls system()
3.

Actual results:

ERROR: ld.so: object '/path/to/some.so' from LD_PRELOAD cannot be preloaded:
ignored.

Expected results:

No 'ERROR' message

Additional info:

按照他的说法,对于32 bit的程序来说,预先加载已经是成功的,尽管出现这个消息。我比较了一下,发现我这边的情况也是类似的,不过这个提示信息确实比较雷人。
the 'ERROR' message cause users to report
problems where there are none. The word 'ERROR' is too strong - it's not really
an error as the application runs fine.