FreeBSD Bugzilla – Attachment 238288 Details for
Bug 267751
lang/gcc*: Address sanitizer isn't properly enabled: ASan runtime does not come first in initial library list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
gcc13-devel - fix sanitizer
0001-lang-gcc13-devel-Fix-Address-sanitizer.patch (text/plain), 1.90 KB, created by
Lorenzo Salvadore
on 2022-11-23 23:42:06 UTC
(
hide
)
Description:
gcc13-devel - fix sanitizer
Filename:
MIME Type:
Creator:
Lorenzo Salvadore
Created:
2022-11-23 23:42:06 UTC
Size:
1.90 KB
patch
obsolete
>From e4d084597431256aa4e86bdb1e4ea2889fc8a422 Mon Sep 17 00:00:00 2001 >From: Lorenzo Salvadore <salvadore@FreeBSD.org> >Date: Wed, 23 Nov 2022 12:51:44 +0100 >Subject: [PATCH] lang/gcc13-devel: Fix Address sanitizer > >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 >--- > .../patch-libsanitizer_asan_asan__linux.cpp | 23 +++++++++++++++++++ > 1 file changed, 23 insertions(+) > create mode 100644 lang/gcc13-devel/files/patch-libsanitizer_asan_asan__linux.cpp > >diff --git a/lang/gcc13-devel/files/patch-libsanitizer_asan_asan__linux.cpp b/lang/gcc13-devel/files/patch-libsanitizer_asan_asan__linux.cpp >new file mode 100644 >index 000000000000..f6c16d8730ee >--- /dev/null >+++ b/lang/gcc13-devel/files/patch-libsanitizer_asan_asan__linux.cpp >@@ -0,0 +1,23 @@ >+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; >+ } >-- >2.38.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 267751
:
238286
|
238287
| 238288 |
247061