git: 4dedcb1bb54c - main - libc/amd64: Disable ASAN for amd64_archlevel.c

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 28 Jan 2024 03:12:57 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4dedcb1bb54cbbe8043c79ad733f966b6ffc6972

commit 4dedcb1bb54cbbe8043c79ad733f966b6ffc6972
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-28 02:49:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-28 03:12:01 +0000

    libc/amd64: Disable ASAN for amd64_archlevel.c
    
    The code in this file runs before the sanitizer can initialize its
    shadow map.
    
    Fixes:  ad2fac552c3f ("lib/libc/amd64: add archlevel-based simd dispatch framework")
---
 lib/libc/amd64/string/Makefile.inc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc
index b1369841bc74..d5bb646c5c53 100644
--- a/lib/libc/amd64/string/Makefile.inc
+++ b/lib/libc/amd64/string/Makefile.inc
@@ -28,3 +28,9 @@ MDSRCS+= \
 	strspn.S \
 	timingsafe_bcmp.S \
 	timingsafe_memcmp.S
+
+.if ${MK_ASAN} != "no"
+# Disable ASAN for amd64_archlevel.c since its code is executed before the
+# sanitizer runtime can initialize itself.
+CFLAGS.amd64_archlevel.c+=	-fno-sanitize=address
+.endif