0

I have a project for which I would like to enable the address sanitizer during testing. It is being built and tested on AWS Linux 2 and the compiler is gcc 7.3.1. I need to have libasan dynamically linked because I am testing a Python extension module and the Python executable itself is not built with asan.

After building/ linking my code with -fsanitize=address, I am starting python (which will load my code) with LD_PRELOAD as /usr/lib/gcc/x86_64-redhat-linux/7/libasan.so. That is the path I get from gcc -print-file-name=libasan.so (and I have confirmed it exists).

When I run, I get

ERROR: ld.so: object '/usr/lib/gcc/x86_64-redhat-linux/7/libasan.so' from LD_PRELOAD cannot be preloaded (file too short): ignored.

Why is this? How do I get libasan to be used? Do I need to install an additional package?

  • 3
    Please try `cat libasan.so` : Can be a 82B text file. A real "shared libasan.so" is a symlink to the ~1.3MB libasan.so.4.0.0 . Example EL7, see item #7 https://stackoverflow.com/questions/47175706/how-to-install-gcc-4-9-2-on-rhel-7-4/47189915#47189915 – Knud Larsen Nov 26 '21 at 19:10

0 Answers0