__asan_default_options not working with -shared-libasan
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
llvm-defaults (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When using the shared libclang_
$ cat test_asan.c
const char *__asan_
return "help=1";
}
int main() { return 0; }
$ clang -fsanitize=address -shared-libasan test_asan.c -o test_asan.
$ LD_PRELOAD=
[no output]
The expected behavior would be the same as you get with:
$ clang -fsanitize=address -static-libsan test_asan.c -o test_asan.
$ ./test_
Available flags for AddressSanitizer:
quarantine_size
- Deprecated, please use quarantine_size_mb. (Current Value: -1)
quarantine_size_mb
- Size (in Mb) of quarantine used to detect use-after-free errors. Lower value may reduce memory usage but increase the chance of false negatives. (Current Value: -1)
thread_
- Size (in Kb) of thread local quarantine used to detect use-after-free errors. Lower value may reduce memory usage but increase the chance of false negatives. It is not advised to go lower than 64Kb, otherwise frequent transfers to global quarantine might affect performance. (Current Value: -1)
redzone
- Minimal size (in bytes) of redzones around heap objects. Requirement: redzone >= 16, is a power of two. (Current Value: 16)
max_redzone
With GCC everything works fine:
$ gcc -fsanitize=address test_asan.c -o test_asan.
$ ldd test_asan.
linux-vdso.so.1 (0x00007ffd4938
libasan.so.5 => /usr/lib/
libc.so.6 => /lib/x86_
libdl.so.2 => /lib/x86_
librt.so.1 => /lib/x86_
libpthread.so.0 => /lib/x86_
libm.so.6 => /lib/x86_
libgcc_s.so.1 => /lib/x86_
/lib64/
$ ./test_
Available flags for AddressSanitizer:
quarantine_size
- Deprecated, please use quarantine_size_mb.
quarantine_size_mb
- Size (in Mb) of quarantine used to detect use-after-free errors. Lower value may reduce memory usage but increase the chance of false negatives.
thread_
- Size (in Kb) of thread local quarantine used to detect use-after-free errors. Lower value may reduce memory usage but increase the chance of false negatives. It is not advised to go lower than 64Kb, otherwise frequent transfers to global quarantine might affect performance.
redzone
- Minimal size (in bytes) of redzones around heap objects. Requirement: redzone >= 16, is a power of two.
max_redzone
The reason seems to be that there is no relocation for the __asan_
$ readelf --relocs /usr/lib/
[no output]
The shared libasan.so used by GCC is fine:
$ readelf --relocs /usr/lib/
000000188358 03fc00000007 R_X86_64_JUMP_SLO 00000000000365d0 __asan_
Note that some other symbols are not affected by this. For example, __lsan_
description: | updated |