[compiler-rt] r267084 - Enable stack-use-after-scope tests.

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 12:29:30 PDT 2016


On 02 May 2016, at 20:43, Ed Maste <emaste at freebsd.org> wrote:
> 
> On 2 May 2016 at 13:15, Evgenii Stepanov <eugeni.stepanov at gmail.com> wrote:
>> file+line should be enough. This is not a debug info / demangler test,
>> let's not make it more fragile then necessary.
> 
> That sounds fine to me. We definitely want to fix the underlying bugs
> in FreeBSD (via libcxxrt / elftoolchain) but this test indeed isn't
> the place to test those.
> 
> One caveat, Dimitry reported that there's another failure due to
> __cxa_demangle turning "foo" into "float". In this case FreeBSD's
> __cxa_demangle is not sufficiently validating its input, but
> __cxa_demangle should not have been called at all.  As __cxa_demangle
> also handles type names it will correctly return "float" for input
> "f", which is not what's desired here. I've submitted
> http://reviews.llvm.org/D19818 for that issue.

Yes, I had tried a similar fix, namely this:

Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
===================================================================
--- projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc	(revision 268169)
+++ projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc	(working copy)
@@ -50,6 +50,10 @@

 // Attempts to demangle the name via __cxa_demangle from __cxxabiv1.
 const char *DemangleCXXABI(const char *name) {
+  // C++ mangled names should start with "_Z".
+  if (name[0] != '_' || name[1] != 'Z')
+    return name;
+
   // FIXME: __cxa_demangle aggressively insists on allocating memory.
   // There's not much we can do about that, short of providing our
   // own demangler (libc++abi's implementation could be adapted so that

but this leads to at least new 4 UBSan failures (which were definitely *not* there before the above fix), for example:

Command Output (stderr):
--
/share/dim/src/llvm/trunk/projects/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp:16:17: error: expected string not found in input
 // CHECK-NEXT: [[PTR]]: note: object is of type 'Foo'
                ^
<stdin>:2:1: note: scanning from here
0xbfbfeb30: note: object is of type '3Foo'
^
<stdin>:2:1: note: with variable "PTR" equal to "0xbfbfeb30"
0xbfbfeb30: note: object is of type '3Foo'
^
<stdin>:2:11: note: possible intended match here
0xbfbfeb30: note: object is of type '3Foo'
          ^

See test-failures.txt for the full details.  It seems that these tests depend on the demangler 'unconditionally' demangling non-C++ mangled names.

-Dimitry
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test-failures.txt
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160502/4f478b0d/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160502/4f478b0d/attachment.sig>


More information about the llvm-commits mailing list