alicelinux

A lightweight musl + clang/llvm + libressl + busybox distro
git clone https://codeberg.org/emmett1/alicelinux
Log | Files | Refs | README | LICENSE

fix-msan-with-musl.patch (1645B)


      1 From 8904ed80c262e973c0da7758337f586c9854f38a Mon Sep 17 00:00:00 2001
      2 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
      3 Date: Thu, 15 Jun 2023 09:28:57 +0200
      4 Subject: [PATCH] msan: fix ifdef guard for getrlimit etc interceptors
      5 
      6 These interceptors need struct_ustat_sz, struct_rlimit64_sz, and
      7 struct_statvfs64_sz which are defined in the following file:
      8 
      9 	compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
     10 
     11 However, these variables are only defined for GLIBC sanitizers.
     12 As such, if we attempt to use MSAN on a Linux system that does not
     13 utilize glibc (e.g. Alpine Linux) then we will get a linker error
     14 complaining about undefined references to __sanitizer::struct_rlimit64_sz
     15 and __sanitizer::struct_rlimit64_sz.
     16 
     17 This patch fixes this by only defining the interceptors that require
     18 these constants if SANITIZER_GLIBC is defined. Thereby aligning the
     19 macro guards of msan_interceptors.cpp with those of
     20 sanitizer_platform_limits_posix.cpp.
     21 ---
     22  compiler-rt/lib/msan/msan_interceptors.cpp | 2 +-
     23  1 file changed, 1 insertion(+), 1 deletion(-)
     24 
     25 diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
     26 index 6f57c33ee..349eff549 100644
     27 --- a/compiler-rt/lib/msan/msan_interceptors.cpp
     28 +++ b/compiler-rt/lib/msan/msan_interceptors.cpp
     29 @@ -908,7 +908,7 @@ INTERCEPTOR(int, getrlimit, int resource, void *rlim) {
     30    INTERCEPTOR_GETRLIMIT_BODY(getrlimit, resource, rlim);
     31  }
     32  
     33 -#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
     34 +#if SANITIZER_GLIBC
     35  INTERCEPTOR(int, __getrlimit, int resource, void *rlim) {
     36    INTERCEPTOR_GETRLIMIT_BODY(__getrlimit, resource, rlim);
     37  }