FreeBSD Bugzilla – Attachment 238287 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]
gcc12-devel - fix sanitizer
0001-lang-gcc12-devel-Fix-Address-sanitizer.patch (text/plain), 1.93 KB, created by
Lorenzo Salvadore
on 2022-11-23 23:41:33 UTC
(
hide
)
Description:
gcc12-devel - fix sanitizer
Filename:
MIME Type:
Creator:
Lorenzo Salvadore
Created:
2022-11-23 23:41:33 UTC
Size:
1.93 KB
patch
obsolete
>From 95377a2b7aac166c9a3b8f4eafeb75c9aaaa5c36 Mon Sep 17 00:00:00 2001 >From: Lorenzo Salvadore <salvadore@FreeBSD.org> >Date: Thu, 24 Nov 2022 00:07:58 +0100 >Subject: [PATCH] lang/gcc12-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 | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > create mode 100644 lang/gcc12-devel/files/patch-libsanitizer_asan_asan__linux.cpp > >diff --git a/lang/gcc12-devel/files/patch-libsanitizer_asan_asan__linux.cpp b/lang/gcc12-devel/files/patch-libsanitizer_asan_asan__linux.cpp >new file mode 100644 >index 000000000000..10cfec69ce6b >--- /dev/null >+++ b/lang/gcc12-devel/files/patch-libsanitizer_asan_asan__linux.cpp >@@ -0,0 +1,18 @@ >+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 23:07:19 UTC >++++ libsanitizer/asan/asan_linux.cpp >+@@ -136,7 +136,7 @@ static int FindFirstDSOCallback(struct dl_phdr_info *i >+ return 0; >+ >+ // Ignore vDSO >+- if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0) >++ if (internal_strncmp(info->dlpi_name, "[vdso]", sizeof("[vdso]") - 1) == 0) >+ return 0; >+ >+ #if SANITIZER_FREEBSD || SANITIZER_NETBSD >-- >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