https://llvm.org/bugs/show_bug.cgi?id=31877
Bug ID: 31877 Summary: Program crashes when throwing exception under memory sanitizer. Product: libc++abi Version: 4.0 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedb...@nondot.org Reporter: halya...@chromium.org CC: k...@google.com, llvm-bugs@lists.llvm.org, mclow.li...@gmail.com Classification: Unclassified The following program crashes with memory sanitizer. test.cpp: #include <stdio.h> #include <exception> // Poison parameters shadow. __attribute__ ((noinline)) void func(int, int, int, int, int, int) { try { throw std::exception(); } catch (std::exception& e) { printf("here\n"); } } int main() { int a, b, c, d, e, f; func(a, b, c, d, e, f); } Compilation: 1. Compile and copy memory-sanitized libc++.so and libc++abi.so to the same folder as test.cpp. 2. clang++ test.cpp -o test -stdlib=libc++ -L. -Wl,-rpath=. -fsanitize=memory Output: ./test ==3802==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x7f51243b3313 in get_thrown_object_ptr /home/halyavin/other/llvm/projects/libcxxabi/src/cxa_personality.cpp:490:27 #1 0x7f51243b3313 in __cxxabiv1::scan_eh_tab(__cxxabiv1::(anonymous namespace)::scan_results&, _Unwind_Action, bool, _Unwind_Exception*, _Unwind_Context*) /home/halyavin/other/llvm/projects/libcxxabi/src/cxa_personality.cpp:736 #2 0x7f51243b14e5 in __gxx_personality_v0 /home/halyavin/other/llvm/projects/libcxxabi/src/cxa_personality.cpp:951:9 #3 0x7f5124995262 (/lib/x86_64-linux-gnu/libgcc_s.so.1+0x10262) #4 0x7f51243aff6d in __cxa_throw /home/halyavin/other/llvm/projects/libcxxabi/src/cxa_exception.cpp:238:5 #5 0x489534 in func(int, int, int, int, int, int) (/home/halyavin/other/msan-exceptions/test+0x489534) #6 0x4897f4 in main (/home/halyavin/other/msan-exceptions/test+0x4897f4) #7 0x7f51245dc82f (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #8 0x419c88 in _start (/home/halyavin/other/msan-exceptions/test+0x419c88) The problem is that libgcc_s.so is not memory sanitized and so it does not update parameters shadow before calling __gxx_personality_v0 function. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs