mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 09:36:41 -04:00
Software compiled with -fsanitize=address fails to run with the error message "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". This commit fixes the issue by ignoring the [vdso] loaded shared library instead of linux-vdso.so. To successfully run the software compiled with -fsanitize=address it is still necessary to disable ASLR. PR: 267751 Reported by: yuri Co-authored-by: Andreas Tobler <andreast@gcc.gnu.org>
23 lines
741 B
C++
23 lines
741 B
C++
Since the vDSO shared librares on Linux and FreeBSD are called
|
|
differently, the initialization order check fails on FreeBSD.
|
|
This patch fixes it by ignoring [vdso] instead of linux-vdso.so.
|
|
|
|
GCC gets the original file from the LLVM Project, so this patch should
|
|
probably be upstreamed directly to the LLVM Project rather than to GCC.
|
|
|
|
|
|
--- libsanitizer/asan/asan_linux.cpp.orig 2022-11-23 11:22:41 UTC
|
|
+++ libsanitizer/asan/asan_linux.cpp
|
|
@@ -148,6 +148,12 @@ static int FindFirstDSOCallback(struct dl_phdr_info *i
|
|
return 0;
|
|
# endif
|
|
|
|
+# if SANITIZER_FREEBSD
|
|
+ // Ignore vDSO
|
|
+ if (internal_strncmp(info->dlpi_name, "[vdso]", sizeof("[vdso]") - 1) == 0)
|
|
+ return 0;
|
|
+# endif
|
|
+
|
|
*name = info->dlpi_name;
|
|
return 1;
|
|
}
|