AW: dlopen: Segfault due to overwriting .so file after it was loaded and loading it again

Konstantin Kharlamov hi-angel@yandex.ru
Fri Nov 20 08:15:53 GMT 2020


On Fri, 2020-11-20 at 08:01 +0000, Wendeborn, Jonathan wrote:
> Hi,
> 
> Thank you for your quick answer!
> I don't have Boost installed globally, so I had to adjust the command:
> g++9 -g3 -O0 -Wall -Wextra -Wsign-conversion -std=c++17 -fsanitize=address  -o
> test2 test.cpp  -I/home/Jonathan.Wendeborn/.boost/1.70/include/  -
> L/home/Jonathan.Wendeborn/.boost/1.70/bin/boost/linux-x86_64-gcc9-debug  -Wl,-
> Bstatic -lboost_filesystem -lboost_system  -Wl,-Bdynamic -ldl
> 
> This is the output:
> ./test2
> pre load
> loaded
> pre load
> loaded
> AddressSanitizer:DEADLYSIGNAL
> =================================================================
> ==2872455==ERROR: AddressSanitizer: SEGV on unknown address 0x000000657726 (pc
> 0x000000657726 bp 0x000000000000 sp 0x7ffc91e7d0a8 T0)
> ==2872455==The signal is caused by a READ memory access.
> AddressSanitizer:DEADLYSIGNAL
> AddressSanitizer: nested bug in the same thread, aborting.
> 
> I didn't test my program with a different .so before, so I copied
> libboost_regex.so to libSomething.so and get a Segfault, too:
> AddressSanitizer:DEADLYSIGNAL
> =================================================================
> ==2872492==ERROR: AddressSanitizer: SEGV on unknown address 0x000000019bd0 (pc
> 0x000000019bd0 bp 0x7ffe22f7b9f0 sp 0x7ffe22f7b938 T0)
> ==2872492==The signal is caused by a READ memory access.

Hmm, doesn't crash with libboost_regex.so for me either… Okay, could you please
provide an `strace` of the testcase when it crashes? Hopefully it could shine
some light into what's going on.



More information about the Libc-help mailing list