[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [llvm-bugs] [Bug 65144] compiler-rt/sanitizers/aarch64: CHECK failed: sanitizer_allocator_primary64.
From:       LLVM Bugs via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date:       2023-08-31 15:21:00
Message-ID: 20230831152100.7159f214aae4d052 () email ! llvm ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

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

    <tr>
        <th>Summary</th>
        <td>
            compiler-rt/sanitizers/aarch64: CHECK failed: \
sanitizer_allocator_primary64.h:133  </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          real-or-random
      </td>
    </tr>
</table>

<pre>
    
#### Symptoms
MSan fails to init with
```
MemorySanitizer: CHECK failed: sanitizer_allocator_primary64.h:133 \
&quot;((kSpaceBeg)) == ((address_range.Init(TotalSpaceSize, PrimaryAllocatorName, \
kSpaceBeg)))&quot; (0xe00000000000, 0xfffffffffffffff4) (tid=23879) ```

#### Environment
This is when running an MSan-instrumented aarch64 binary via `qemu-aarch64`.  \
I&apos;m using a clang snapshot: ```
Debian clang version 18.0.0 (++20230829112257+96e83d3705c7-1~exp1~20230829112313.180) \
 ```

People report similar issues on Raspberry Pi 4, with ASan, and with Clang 16 and \
                Clang 17, while Clang 15 works:
 - https://github.com/google/sanitizers/issues/1674
 - https://github.com/google/sanitizers/issues/1329
 - https://raspberrypi.stackexchange.com/questions/144012/clang-sanitizers-fail
 - https://gitlab.alpinelinux.org/alpine/aports/-/issues/15025
 - https://groups.google.com/g/thread-sanitizer/c/ML3IEO8Yby8 (but this one lacks \
details...)

So this seems to be a regression between 15 and 16.

#### Possible causes and fix

I have a strong suspicion that the reason for this is the commit \
https://github.com/llvm/llvm-project/commit/a588cfe37ea36ec4fae35a233a13d3557fba86e9, \
but I haven&apos;t tested recompiling with `-DSANITIZER_CAN_USE_ALLOCATOR64=0`. 

When I use qemu&apos;s strace functionality, I get this just before the crash:
```
mmap(0x0000e00000000000,8192,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED|MAP_NORESERVE,-1,0) \
= -1 errno=12 (Cannot allocate memory) ```
And note that the value `0xfffffffffffffff4` from the assertion is equal to `-12`. \
Here, `0x0000e00000000000` is a 48-bit address, but perhaps QEMU&apos;s emulation \
supports only smaller (39 bits)? I suspect that the Raspberry Pi 4 also has a virtual \
address space smaller than 48 bits. When I try this with Clang 14, I see only mmap \
calls up to address `0x0000006000000000` (which is a 39-bit address).

The AArch64 memory layout on Linux can vary a lot \
(https://www.kernel.org/doc/html/v5.8/arm64/memory.html). Possible virtual address \
sizes are 39 bits, 42 bits, 48 bits, and 52 bits. Perhaps it&apos;s a good idea to \
detect this at runtime in the 64-bit allocator?


(note: Not sure if this is the right place to report. It seems to me that this is a \
compiler-rt issue, which seem to be tracked here? But please close if the existing \
https://github.com/google/sanitizers/issues/1674 is a better place to track this.) \
</pre> <img width="1px" height="1px" alt="" \
src="http://email.email.llvm.org/o/eJysVktv4zrS_TXMpmBBoh6WF144fuAaX3eSL07fmTubgJbKFm8 \
oUk1SSdyL-9sHRclxp7szwDwMIZFIVrF46tQpCufkUSPOWX7N8tWV6H1j7NyiUBNjJ1bo2rRXe1Of5ixesXjBe \
Pr2wO7Udt60bpj6vBMaDkIqB96A1NLDi_TNaFfE4zOsxdbY005o6eU3tCxdwPK39fL_gj3W9O3Ok49CKVMJb-x \
jZ2Ur7KnIooaliyRNgXHOeMl4-bTrRIXXeGR8xvgMWLpi6QqGSVHXFp17tEIfMdpq6RkvH4wXKljt5DdkfAl3g \
_vFeb8b0YbxH3yHh5Pr-BXjy4-Wxq-H978sBMNLL2uWrnhaToP9r0D5BcJr_Syt0S1qP8w-NNK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E7hWKIWWDp7OYC-p7Gcs3cA2UB0rfznZe1kGoZyBRlAQz9J6OsAYBTjqtW--fSM0ZGXwHsHIJW9PA0m-V_JsI \
JBDHKIjTkAllHLQdwTPeYM3TOK4eIcJ4-VLI6tmACedvQdn9k4LHhqExWLosEOWQYmT6T31oE8kjFAJDc_UegU \
o48n7-3p-eXmJntBqVKOG1ob0rfGtYnzznEclFbJti4zxzbBHNEzOoov8_ASf_EZqZBHecrKEjF9ey7dXkqycj \
9DejVkn-ZjS-Y_G1CBrFIRdjX5IJ0Hj6eLhZYsgdUhukQ1Qne9NLN28081RPUsiO13tbowH11sEeXgne1YeGw- \
dIgJ4M_b4CLb-otjtW7UMZgIGlUI7sX64BoxNvGqC1SjzJDhPWENDhZFu4JqIrlA4hEoZN4aCgK_SeZK8_67ND \
6Ht0Xu0lwOFIELo1Jmu6nlaz9KZuMJ5UszSbJbzIr5q5hzrepalmB3ydCZEIeppMs33SVwiL5Myv5Lz4dqUJkn \
OkziOpkk-O_AkEwKzOs45y2JshVQR9Qdi11WIbl7kSZZdKbFH5c5XfjsPTWTfHx3LYiWddxczL73C-XcQ_3jq81XyP73AX_VWzf_tPveGdTjQPwMAAP__Qjr9NQ">



[Attachment #3 (text/plain)]

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic