Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asan library fails with Shadow memory range interleaves with an existing memory mapping

When you load lib asan ,then it fails with below error : Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.

I loaded library using LD_PRELOAD ,then starting the process it fails as above mentioned error.

Thanks in advance.

like image 562
anil valmiki Avatar asked Nov 20 '22 04:11

anil valmiki


1 Answers

I found a cause for this for 32-bit targets that isn't mentioned in the AddressSanitizer FAQ. If your stack size is unlimited (i.e. you've run ulimit -s unlimited), then a huge amount of address space is reserved at the top of the process mapping for the stack to grow into. This means that the dynamic linker, vdso, libasan.so and other shared libraries are loaded at 0x2aaab000 and below (for me on x86) which conflicts with the address range that ASAN wishes to use.

This is not seen often since the default soft stack limit on Linux is 8192 which leaves plenty of address space below the shared libraries for ASAN. The fix is to set a more appropriate stack size limit.

like image 138
Mike Crowe Avatar answered Jun 29 '23 02:06

Mike Crowe