<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/87483>87483</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `SanitizerCommon-lsan-x86_64-Darwin :: Darwin/malloc_zone.cpp` fails on macOS 14
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            platform:macos,
            compiler-rt:sanitizer
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zmodem
      </td>
    </tr>
</table>

<pre>
    The test started failing in our build environment after it moved from macOS 13.5.2 to 14.4.1:

```
FAIL: SanitizerCommon-lsan-x86_64-Darwin :: Darwin/malloc_zone.cpp (73456 of 77879)
 ******************** TEST 'SanitizerCommon-lsan-x86_64-Darwin :: Darwin/malloc_zone.cpp' FAILED ********************
 Exit Code: 2
 
 Command Output (stderr):
 --
 RUN: at line 10: echo "leak:create_and_insert_msl_lite_zone" >> lsan.supp
 + echo leak:create_and_insert_msl_lite_zone
 RUN: at line 12: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=leak  -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mlinker-version=820.1 -I/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test -g /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Darwin/Darwin/Output/malloc_zone.cpp.tmp
 + /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=leak -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mlinker-version=820.1 -I/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test -g /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Darwin/Darwin/Output/malloc_zone.cpp.tmp
 RUN: at line 13: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Darwin/Darwin/Output/malloc_zone.cpp.tmp | FileCheck /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp
 + /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Darwin/Darwin/Output/malloc_zone.cpp.tmp
 + FileCheck /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp
 RUN: at line 14: env MallocStackLogging=lite LSAN_OPTIONS=suppressions=lsan.supp /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Darwin/Darwin/Output/malloc_zone.cpp.tmp | FileCheck /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp
 + env MallocStackLogging=lite LSAN_OPTIONS=suppressions=lsan.supp /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-x86_64-Darwin/Darwin/Output/malloc_zone.cpp.tmp
 + FileCheck /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp
 LeakSanitizer: bad pointer 0x7ff91c394221
 LeakSanitizer: CHECK failed: sanitizer_allocator_secondary.h:177 "((IsAligned(reinterpret_cast<uptr>(p), page_size_))) != (0)" (0x0, 0x0) (tid=2014389)
 FileCheck error: '<stdin>' is empty.
 FileCheck command line:  FileCheck /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp
 
 --
 
 ********************
```

We didn't see any relevant LLVM changes around the time when the failure started, so it seems related to the OS version.

(See also https://crbug.com/332589870)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWN9vm74W_2uclyMQ2DSQhzykSdGt1q3T0rvtDTlwAr41NrJN1vavv7KTtF23Sbt31bZ-NwmBbQ7n5-cc7MOtFa1CnJOTU3KymvDRddrM73rdYD_Z6OZ2ftUhOLQOrOPGYQNbLqRQLQgFejSwGYVsANVOGK16VA741qEB4aDXO09vdA89ry_XkLL4JKbgNKRZnMUpYQuSrEhyvE-TwxWm5eL8grAFrLkSTtyhWeq-1yqSlqvopphW0yxacfNJKPCM2AL2M0LLnkup6-pOK4zrYQBCi5xlJ1PQW8jzIp8ROtsLAUIX__cFV2frKyA0_3EVCc3BG3y2-iGNDkad3QgHS92gF0mPlu4fXkWuGrgc3TA67xrrGjTGu-QYD4iiw-Ddv994HtyBFAohTfwM604DoVQivyZsURvkDiuumkooi8ZVvZWVFA6DeYRSIOyMsDPwfontOAz3zj_dM_tOTl_XifoZoeV7LcceLaHlB22uCS398BOhpTCEljWvOyS0DIBFv2JNTWjpOmGaauDG3RJaSrnro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