aboutsummaryrefslogtreecommitdiff
path: root/llvm/fix-msan-with-musl.patch
diff options
context:
space:
mode:
authorWoodpecker CI <emmett1.2miligrams@protonmail.com>2025-06-03 14:32:34 +0000
committerWoodpecker CI <emmett1.2miligrams@protonmail.com>2025-06-03 14:32:34 +0000
commit8df1d35909ec2d57a6845f5b2c26ee1e83cfd032 (patch)
tree88e5aaa8cf9d3c0538cdff935a56786705548d75 /llvm/fix-msan-with-musl.patch
parent96ec28ea0d2c05032f40f50bc6b9de7020138f57 (diff)
downloadalicelinux-8df1d35909ec2d57a6845f5b2c26ee1e83cfd032.tar.gz
alicelinux-8df1d35909ec2d57a6845f5b2c26ee1e83cfd032.zip
Woodpecker CI 5171f1fdd74e7137c305450dd69a29fa5be4143f [SKIP CI]
Diffstat (limited to 'llvm/fix-msan-with-musl.patch')
-rw-r--r--llvm/fix-msan-with-musl.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/fix-msan-with-musl.patch b/llvm/fix-msan-with-musl.patch
new file mode 100644
index 00000000..0def1610
--- /dev/null
+++ b/llvm/fix-msan-with-musl.patch
@@ -0,0 +1,37 @@
+From 8904ed80c262e973c0da7758337f586c9854f38a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Thu, 15 Jun 2023 09:28:57 +0200
+Subject: [PATCH] msan: fix ifdef guard for getrlimit etc interceptors
+
+These interceptors need struct_ustat_sz, struct_rlimit64_sz, and
+struct_statvfs64_sz which are defined in the following file:
+
+ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+
+However, these variables are only defined for GLIBC sanitizers.
+As such, if we attempt to use MSAN on a Linux system that does not
+utilize glibc (e.g. Alpine Linux) then we will get a linker error
+complaining about undefined references to __sanitizer::struct_rlimit64_sz
+and __sanitizer::struct_rlimit64_sz.
+
+This patch fixes this by only defining the interceptors that require
+these constants if SANITIZER_GLIBC is defined. Thereby aligning the
+macro guards of msan_interceptors.cpp with those of
+sanitizer_platform_limits_posix.cpp.
+---
+ compiler-rt/lib/msan/msan_interceptors.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
+index 6f57c33ee..349eff549 100644
+--- a/compiler-rt/lib/msan/msan_interceptors.cpp
++++ b/compiler-rt/lib/msan/msan_interceptors.cpp
+@@ -908,7 +908,7 @@ INTERCEPTOR(int, getrlimit, int resource, void *rlim) {
+ INTERCEPTOR_GETRLIMIT_BODY(getrlimit, resource, rlim);
+ }
+
+-#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
++#if SANITIZER_GLIBC
+ INTERCEPTOR(int, __getrlimit, int resource, void *rlim) {
+ INTERCEPTOR_GETRLIMIT_BODY(__getrlimit, resource, rlim);
+ }