A runtime can be statically linked twice into several modules. My plan
was to just look at some runtime symbols with dlsym(RTLD_NEXT).


On Mon, Oct 13, 2014 at 10:06 AM, Yury Gribov <[email protected]> wrote:
> On 10/12/2014 11:27 AM, [email protected] wrote:
>>
>>
>> Comment #7 on issue 240 by [email protected]: Detect when asan runtime
>> is loaded twice into the same process
>> https://code.google.com/p/address-sanitizer/issues/detail?id=240
>>
>> Another case seen in the wild.
>>
>> Clang-built program with -fsanitize=thread does:
>> 14742 open("/usr/lib/x86_64-linux-gnu/libtsan.so.0", O_RDONLY|O_CLOEXEC)
>> = 3
>>
>> which is gcc! runtime.
>>
>> Then the process crashes after double-mapping heap space:
>>
>> 14742 mmap(0x7d0000000000, 1099511627776, PROT_NONE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7d0000000000
>> 14742 mmap(0x7e0000000000, 12288, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7e0000000000
>> 14742 futex(0x7fe5d2eea0d0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
>> 14742 mmap(0x7d0800000000, 65536, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7d0800000000
>> 14742 mmap(0x7d0bffff0000, 65536, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7d0bffff0000
>> 14742 mmap(0x7d6400000000, 131072, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7d6400000000
>> 14742 mmap(0x7d67ffff0000, 65536, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7d67ffff0000
>> 14742 mmap(NULL, 33554432, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe5cbbf8000
>> 14742 munmap(0x7fe5cbbf8000, 4227072)   = 0
>> 14742 munmap(0x7fe5cd000000, 12550144)  = 0
>> 14742 mmap(0x7d0000000000, 1099511627776, PROT_NONE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7d0000000000
>> 14742 mmap(0x7e0000000000, 20480, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7e0000000000
>> 14742 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR,
>> si_addr=0x7d080000eff8} ---
>>
>>
>> A typical user is not capable of dubugging this w/o our help.
>
>
> We could do something similar to AsanCheckDynamicRTPrereqs.
>
> -Y
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to