git: 7b6f5ebef681 - main - Add several sanitizer ignore lists under /usr/lib/clang

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 28 May 2022 13:47:10 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b6f5ebef68194c09708abeb6426ca7602b6dab1

commit 7b6f5ebef68194c09708abeb6426ca7602b6dab1
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-05-27 18:23:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-05-28 13:46:38 +0000

    Add several sanitizer ignore lists under /usr/lib/clang
    
    Some of the sanitizers from compiler-rt can use ignore lists, which are
    loosely modeled on valgrind's example. Upstream provides default lists
    for AddressSanitizer, CFI, and MemorySanitizer, so install these in the
    expected location, /usr/lib/clang/14.0.3/share.
    
    Reviewed by:    emaste
    MFC after:      2 weeks
    Differential Revision: https://reviews.freebsd.org/D35338
---
 etc/mtree/BSD.usr.dist                   | 2 ++
 lib/libclang_rt/asan/Makefile            | 3 +++
 lib/libclang_rt/cfi/Makefile             | 3 +++
 lib/libclang_rt/compiler-rt-vars.mk      | 1 +
 lib/libclang_rt/msan/Makefile            | 3 +++
 tools/build/mk/OptionalObsoleteFiles.inc | 4 ++++
 6 files changed, 16 insertions(+)

diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist
index 3aac572a314f..aaea188d7c97 100644
--- a/etc/mtree/BSD.usr.dist
+++ b/etc/mtree/BSD.usr.dist
@@ -57,6 +57,8 @@
                 lib
                     freebsd
                     ..
+                share
+                    ..
                 ..
             ..
         ..
diff --git a/lib/libclang_rt/asan/Makefile b/lib/libclang_rt/asan/Makefile
index 66641c7e9121..3ad706cd3c9d 100644
--- a/lib/libclang_rt/asan/Makefile
+++ b/lib/libclang_rt/asan/Makefile
@@ -80,4 +80,7 @@ SRCS+=		ubsan/ubsan_init.cpp
 SRCS+=		ubsan/ubsan_monitor.cpp
 SRCS+=		ubsan/ubsan_value.cpp
 
+FILESDIR=	${SANITIZER_SHAREDIR}
+FILES+=		asan/asan_ignorelist.txt
+
 .include <bsd.lib.mk>
diff --git a/lib/libclang_rt/cfi/Makefile b/lib/libclang_rt/cfi/Makefile
index 9910565b2f38..fffd62ab0d3e 100644
--- a/lib/libclang_rt/cfi/Makefile
+++ b/lib/libclang_rt/cfi/Makefile
@@ -36,4 +36,7 @@ SRCS+=		sanitizer_common/sanitizer_thread_registry.cpp
 SRCS+=		sanitizer_common/sanitizer_tls_get_addr.cpp
 SRCS+=		sanitizer_common/sanitizer_type_traits.cpp
 
+FILESDIR=	${SANITIZER_SHAREDIR}
+FILES+=		cfi/cfi_ignorelist.txt
+
 .include <bsd.lib.mk>
diff --git a/lib/libclang_rt/compiler-rt-vars.mk b/lib/libclang_rt/compiler-rt-vars.mk
index 78468be5f465..525f85b492ae 100644
--- a/lib/libclang_rt/compiler-rt-vars.mk
+++ b/lib/libclang_rt/compiler-rt-vars.mk
@@ -1,6 +1,7 @@
 CLANG_SUBDIR=clang/14.0.3
 CLANGDIR=	/usr/lib/${CLANG_SUBDIR}
 SANITIZER_LIBDIR=		${CLANGDIR}/lib/freebsd
+SANITIZER_SHAREDIR=		${CLANGDIR}/share
 
 # armv[67] is a bit special since we allow a soft-floating version via
 # CPUTYPE matching *soft*. This variant may not actually work though.
diff --git a/lib/libclang_rt/msan/Makefile b/lib/libclang_rt/msan/Makefile
index 76e05af7462c..12a6f035d71f 100644
--- a/lib/libclang_rt/msan/Makefile
+++ b/lib/libclang_rt/msan/Makefile
@@ -64,4 +64,7 @@ SRCS+=		ubsan/ubsan_init.cpp
 SRCS+=		ubsan/ubsan_monitor.cpp
 SRCS+=		ubsan/ubsan_value.cpp
 
+FILESDIR=	${SANITIZER_SHAREDIR}
+FILES+=		msan/msan_ignorelist.txt
+
 .include <bsd.lib.mk>
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 6a1776690608..3c3060166592 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -1488,6 +1488,10 @@ OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-profiling-x86_64.a
 OLD_FILES+=usr/lib/clang/14.0.3/lib/freebsd/libclang_rt.xray-x86_64.a
 OLD_DIRS+=usr/lib/clang/14.0.3/lib/freebsd
 OLD_DIRS+=usr/lib/clang/14.0.3/lib
+OLD_FILES+=usr/lib/clang/14.0.3/share/asan_ignorelist.txt
+OLD_FILES+=usr/lib/clang/14.0.3/share/cfi_ignorelist.txt
+OLD_FILES+=usr/lib/clang/14.0.3/share/msan_ignorelist.txt
+OLD_DIRS+=usr/lib/clang/14.0.3/share
 OLD_DIRS+=usr/lib/clang/14.0.3
 OLD_DIRS+=usr/lib/clang
 OLD_FILES+=usr/share/doc/llvm/clang/LICENSE.TXT