[llvm-bugs] [Bug 31402] New: UBSan complains about map::__find_equal_key (invalid upcast)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 15 17:01:07 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31402

            Bug ID: 31402
           Summary: UBSan complains about map::__find_equal_key (invalid
                    upcast)
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vsk at apple.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

UBSan complains about an invalid upcast in map::__find_equal_key. Here are the
steps I took to reproduce this issue:

1) Check out an ToT llvm and libcxx.

2) Revert r264989 from the libcxx checkout. That's:

"Fix LWG issue 2469 - Use piecewise construction in map::operator[]."

3) Configure llvm with this cmake command:

cmake -G Ninja \
    -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
    -DCMAKE_BUILD_TYPE:STRING=Release \
    -DLLVM_ENABLE_ASSERTIONS:BOOL=On \
    -DLLVM_USE_SANITIZER=Undefined \
    ..

It's important to use "Release". This is an -fsanitize=object-size violation,
so we need optimizations on to trigger it.

4) Make sure we're building with our libcxx checkout. E.g:

$ export CCC_OVERRIDE_OPTIONS="+-I/Users/vk/Desktop/llvm/projects/libcxx"

The QA override is a convenient way to do this.

5) Build the lib/Target/ARM/ARMGenAsmMatcher.inc target. E.g:

$ ninja -v lib/Target/ARM/ARMGenAsmMatcher.inc

6) I then get:

FAILED: lib/Target/ARM/ARMGenAsmMatcher.inc.tmp 
cd /Users/vk/Desktop/llvm/ubsan-R/lib/Target/ARM &&
/Users/vk/Desktop/llvm/ubsan-R/bin/llvm-tblgen -gen-asm-matcher -I
/Users/vk/Desktop/llvm/lib/Target/ARM -I /Users/vk/Desktop/llvm/include -I
/Users/vk/Desktop/llvm/lib/Target /Users/vk/Desktop/llvm/lib/Target/ARM/ARM.td
-o /Users/vk/Desktop/llvm/ubsan-R/lib/Target/ARM/ARMGenAsmMatcher.inc.tmp
/Users/vk/Desktop/llvm/projects/libcxx/include/map:1382:16: runtime error:
downcast of address 0x7fff5c878208 with insufficient space for an object of
type 'std::__1::__tree_node_base<void *>'
0x7fff5c878208: note: pointer points here
 ff 7f 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  05 01 73 65 72
73 2f 76  74 bd 64 03
              ^ 
0  llvm-tblgen              0x000000010354dff6 llvm::sys::RunSignalHandlers() +
118
1  llvm-tblgen              0x000000010354f6e1 SignalHandler(int) + 321
2  libsystem_platform.dylib 0x00007fffb6d2cfba _sigtramp + 26
Stack dump:
0.      Program arguments: /Users/vk/Desktop/llvm/ubsan-R/bin/llvm-tblgen
-gen-asm-matcher -I /Users/vk/Desktop/llvm/lib/Target/ARM -I
/Users/vk/Desktop/llvm/include -I /Users/vk/Desktop/llvm/lib/Target
/Users/vk/Desktop/llvm/lib/Target/ARM/ARM.td -o
/Users/vk/Desktop/llvm/ubsan-R/lib/Target/ARM/ARMGenAsmMatcher.inc.tmp 
/bin/sh: line 1: 59222 Abort trap: 6          
/Users/vk/Desktop/llvm/ubsan-R/bin/llvm-tblgen -gen-asm-matcher -I
/Users/vk/Desktop/llvm/lib/Target/ARM -I /Users/vk/Desktop/llvm/include -I
/Users/vk/Desktop/llvm/lib/Target /Users/vk/Desktop/llvm/lib/Target/ARM/ARM.td
-o /Users/vk/Desktop/llvm/ubsan-R/lib/Target/ARM/ARMGenAsmMatcher.inc.tmp
ninja: build stopped: subcommand failed.

I believe the issue is masked on our bots by r264989 because we stop calling
__find_equal_key as often.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161216/bdef769b/attachment.html>


More information about the llvm-bugs mailing list