git: 89cc83362f4d - stable/13 - Fix GENERIC-KASAN kernel build for amd64

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 20 Apr 2024 10:34:48 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=89cc83362f4d4d5733a2a7446b0b4be63596e09c

commit 89cc83362f4d4d5733a2a7446b0b4be63596e09c
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-04-07 17:56:03 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-04-20 10:29:09 +0000

    Fix GENERIC-KASAN kernel build for amd64
    
    Work around https://github.com/llvm/llvm-project/issues/87923, which
    leads to an assertion failure compiling several kernel source files with
    asan enabled.
    
    PR:             276104
    MFC after:      1 month
    
    (cherry picked from commit b811dac2115a6ada606c03d7d823a95d11c5f3c9)
---
 sys/conf/kern.pre.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index b47b89daa008..ea3cc1986575 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -119,6 +119,13 @@ SAN_CFLAGS+=	-DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kasan \
 		-mllvm -asan-use-after-scope=true \
 		-mllvm -asan-instrumentation-with-call-threshold=0 \
 		-mllvm -asan-instrument-byval=false
+
+.if ${MACHINE_CPUARCH} == "amd64" && \
+      ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000
+# Work around https://github.com/llvm/llvm-project/issues/87923, which leads to
+# an assertion failure compiling dtrace.c with asan enabled.
+SAN_CFLAGS+=	-mllvm -asan-use-stack-safety=0
+.endif
 .endif
 
 KCSAN_ENABLED!=	grep KCSAN opt_global.h || true ; echo