[compiler-rt] 1da9d8a - [asan] Ignore vDSO on FreeBSD (#76223)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 29 12:39:31 PST 2023
Author: Rainer Orth
Date: 2023-12-29T21:39:27+01:00
New Revision: 1da9d8aea01a433ffc0b0339c9b63285cd471980
URL: https://github.com/llvm/llvm-project/commit/1da9d8aea01a433ffc0b0339c9b63285cd471980
DIFF: https://github.com/llvm/llvm-project/commit/1da9d8aea01a433ffc0b0339c9b63285cd471980.diff
LOG: [asan] Ignore vDSO on FreeBSD (#76223)
Most asan tests `FAIL` on FreeBSD 14.0/amd64 with
```
==17651==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
```
With `ASAN_OPTIONS=verbosity=2` one sees:
```
==4880==info->dlpi_name = [vdso] info->dlpi_addr = 0xffffe780
==4880==info->dlpi_name = lib/clang/18/lib/freebsd/libclang_rt.asan-i386.so info->dlpi_addr = 0x2808a000
```
Ignoring the vDSO as on Linux fixes this.
Tested on `amd64-pc-freebsd14.0`.
Added:
Modified:
compiler-rt/lib/asan/asan_linux.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_linux.cpp b/compiler-rt/lib/asan/asan_linux.cpp
index 262cf7e2cfff97..37d3bad1b1ec62 100644
--- a/compiler-rt/lib/asan/asan_linux.cpp
+++ b/compiler-rt/lib/asan/asan_linux.cpp
@@ -140,6 +140,11 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0;
# endif
+# if SANITIZER_FREEBSD
+ // Ignore vDSO.
+ if (internal_strcmp(info->dlpi_name, "[vdso]") == 0)
+ return 0;
+# endif
*name = info->dlpi_name;
return 1;
More information about the llvm-commits
mailing list