Page MenuHomePhabricator

XFAIL one sanitizer symbolizer test for FreeBSD
ClosedPublic

Authored by dim on Jul 31 2016, 9:05 AM.

Details

Summary

Due to a QoI issuse in FreeBSD's libcxxrt-based demangler, one sanitizer
symbolizer test consistently appears to fail:

Value of: DemangleSwiftAndCXX("foo")
  Actual: "float"
Expected: "foo"

This is because libcxxrt's __cxa_demangle() incorrectly demangles the "foo"
identifier to "float". It should return an error instead.

For now, XFAIL this particular test for FreeBSD, until we can fix libcxxrt
properly (which might take some time to coordinate with upstream).

Diff Detail

Event Timeline

dim updated this revision to Diff 66244.Jul 31 2016, 9:05 AM
dim retitled this revision from to XFAIL one sanitizer symbolizer test for FreeBSD.
dim updated this object.
dim added reviewers: emaste, rnk, zaks.anna.
dim added a subscriber: llvm-commits.
zaks.anna accepted this revision.Jul 31 2016, 9:29 AM
zaks.anna edited edge metadata.
This revision is now accepted and ready to land.Jul 31 2016, 9:29 AM
emaste accepted this revision.Jul 31 2016, 10:52 AM
emaste edited edge metadata.

There's also an issue here in the sanitizer: what DemangleSwiftAndCXX("f") should return is ambiguous. But this makes sense in the interim.

dim closed this revision.Jul 31 2016, 12:35 PM
dim added a comment.Jul 31 2016, 12:46 PM

There's also an issue here in the sanitizer: what DemangleSwiftAndCXX("f") should return is ambiguous.

Both on FreeBSD, Linux and OSX calling __cxa_demangle() with "f" always returns "float". So I guess that is at least a de facto 'correct' result.

As far as I can see in asan and ubsan, where the demangler is called, it always uses external knowledge about the symbol to see whether it should be demangled at all. For instance, lib/asan/asan_report.cc's MaybeDemangleGlobalName():

static const char *MaybeDemangleGlobalName(const char *name) {
  // We can spoil names of globals with C linkage, so use an heuristic
  // approach to check if the name should be demangled.
  bool should_demangle = false;
  if (name[0] == '_' && name[1] == 'Z')
    should_demangle = true;
  else if (SANITIZER_WINDOWS && name[0] == '\01' && name[1] == '?')
    should_demangle = true;

  return should_demangle ? Symbolizer::GetOrInit()->Demangle(name) : name;
}

Maybe it makes sense to change the test to detangle something other than "foo"?