<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AddressSanitizer: Failed CHECKs on FreeBSD"
   href="https://bugs.llvm.org/show_bug.cgi?id=34606">34606</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AddressSanitizer: Failed CHECKs on FreeBSD
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>m@mikaelsimonsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

I'm trying to switch from LLVM 4.0 to 5.0 for a C++ project on FreeBSD, but I
can't get the sanitizers to work correctly. I'm getting failed CHECKs on both
the release_50 and the master-branch. Am I missing something?

A simple buffer overflow test:

=================================================================
==8195==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000001c
at pc 0x00000049578a bp 0x7fffffffe9c0 sp 0x7fffffffe9b8
WRITE of size 1 at 0x60200000001c thread T16777215
    #0 0x495789  (/usr/home/mikael/project/overflow+0x495789)
    #1 0x40dede  (/usr/home/mikael/project/overflow+0x40dede)
    #2 0x8006d8fff  (<unknown module>)

0x60200000001c is located 2 bytes to the right of 10-byte region
[0x602000000010,0x60200000001a)
==8195==AddressSanitizer CHECK failed:
/home/mikael/resource/llvm/projects/compiler-rt/lib/asan/asan_descriptions.cc:176
"((id)) != (0)" (0x0, 0x0)
    #0 0x47494f  (/usr/home/mikael/project/overflow+0x47494f)
    #1 0x487fbf  (/usr/home/mikael/project/overflow+0x487fbf)
    #2 0x415385  (/usr/home/mikael/project/overflow+0x415385)
    #3 0x4182d1  (/usr/home/mikael/project/overflow+0x4182d1)
    #4 0x471321  (/usr/home/mikael/project/overflow+0x471321)
    #5 0x4723f7  (/usr/home/mikael/project/overflow+0x4723f7)
    #6 0x472ddd  (/usr/home/mikael/project/overflow+0x472ddd)
    #7 0x495789  (/usr/home/mikael/project/overflow+0x495789)
    #8 0x40dede  (/usr/home/mikael/project/overflow+0x40dede)
    #9 0x8006d8fff  (<unknown module>)


Testing a parser with libFuzzer:

==8289==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top:
0x7ffffffff000; bottom 0x7fffdffff000; size: 0x000020000000 (536870912)
False positive error reports may follow
For details see <a href="https://github.com/google/sanitizers/issues/189">https://github.com/google/sanitizers/issues/189</a>
=================================================================
==8289==AddressSanitizer CHECK failed:
/home/mikael/resource/llvm/projects/compiler-rt/lib/asan/asan_thread.cc:342
"((ptr[0] == kCurrentStackFrameMagic)) != (0)" (0x0, 0x0)
    #0 0x47825f  (/usr/home/mikael/project/parse.fuzz+0x47825f)
    #1 0x48b8cf  (/usr/home/mikael/project/parse.fuzz+0x48b8cf)
    #2 0x47a838  (/usr/home/mikael/project/parse.fuzz+0x47a838)
    #3 0x4196c7  (/usr/home/mikael/project/parse.fuzz+0x4196c7)
    #4 0x41b2f5  (/usr/home/mikael/project/parse.fuzz+0x41b2f5)
    #5 0x475ca1  (/usr/home/mikael/project/parse.fuzz+0x475ca1)
    #6 0x42a684  (/usr/home/mikael/project/parse.fuzz+0x42a684)
    #7 0x801461cf6  (/lib/libgcc_s.so.1+0x2cf6)
    #8 0x800bfb864  (/lib/libcxxrt.so.1+0x12864)
    #9 0x49f721  (/usr/home/mikael/project/parse.fuzz+0x49f721)
    #10 0x499611  (/usr/home/mikael/project/parse.fuzz+0x499611)
    #11 0x49915c  (/usr/home/mikael/project/parse.fuzz+0x49915c)
    #12 0x4b5662  (/usr/home/mikael/project/parse.fuzz+0x4b5662)
    #13 0x4b607a  (/usr/home/mikael/project/parse.fuzz+0x4b607a)
    #14 0x4b6870  (/usr/home/mikael/project/parse.fuzz+0x4b6870)
    #15 0x4b6b05  (/usr/home/mikael/project/parse.fuzz+0x4b6b05)
    #16 0x4ae69f  (/usr/home/mikael/project/parse.fuzz+0x4ae69f)
    #17 0x4a9f80  (/usr/home/mikael/project/parse.fuzz+0x4a9f80)
    #18 0x4117ee  (/usr/home/mikael/project/parse.fuzz+0x4117ee)
    #19 0x800723fff  (<unknown module>)


Both of these work perfectly with LLVM 4.0 (installed from ports).

% /usr/local/llvm_custom/bin/clang++ --version
clang version 6.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
1a3d0f5bb357c488df256447b0cb90614be45429)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
d2c2deaeccd0ec7043589a54de4a5e7da7b80e68)
Target: x86_64-unknown-freebsd11.1
Thread model: posix
InstalledDir: /usr/local/llvm_custom/bin</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>