[sanitizer] Split Symbolizer/StackTraces from core RTSanitizerCommon
ClosedPublic

Authored by cryptoad on Mon, Apr 9, 2:26 PM.

Details

Summary

Host symbolizer & stacktraces related code in their own RT:
RTSanitizerCommonSymbolizer, which is "libcdep" by nature. Symbolizer &
stacktraces specific code that used to live in common files is moved to a new
file sanitizer_symbolizer_report.cc as is.

The purpose of this is the enforce a separation between code that relies on
symbolization and code that doesn't. This saves the inclusion of spurious code
due to the interface functions with default visibility, and the extra data
associated.

The following sanitizers makefiles were modified & tested locally:

  • dfsan: doesn't require the new symbolizer RT
  • esan: requires it
  • hwasan: requires it
  • lsan: requires it
  • msan: requires it
  • safestack: doesn't require it
  • xray: doesn't require it
  • tsan: requires it
  • ubsan: requires it
  • ubsan_minimal: doesn't require it
  • scudo: requires it (but not for Fuchsia that has a minimal runtime)

This was tested locally on Linux, Android, Fuchsia.

Diff Detail

cryptoad created this revision.Mon, Apr 9, 2:26 PM
Herald added subscribers: Restricted Project, llvm-commits, delcypher and 4 others. · View Herald TranscriptMon, Apr 9, 2:26 PM
cryptoad updated this revision to Diff 141850.Tue, Apr 10, 7:48 AM

Fuchsia related changes.

cryptoad edited the summary of this revision. (Show Details)Wed, Apr 11, 8:24 AM
cryptoad added a reviewer: mcgrathr.
cryptoad updated this revision to Diff 142032.Wed, Apr 11, 10:01 AM

Removing sanitizer_symbolizer.h from sanitizer_coverage_libcdep_new.cc.

cryptoad updated this revision to Diff 142039.Wed, Apr 11, 10:20 AM

Adding the forgotten LLVM comment header to the new file.

alekseyshl accepted this revision.Wed, Apr 11, 10:28 AM
alekseyshl added inline comments.
lib/sanitizer_common/sanitizer_symbolizer_report.cc
9

You're one dash short here and in the line below :)

11

Remove extra /

This revision is now accepted and ready to land.Wed, Apr 11, 10:28 AM
cryptoad updated this revision to Diff 142044.Wed, Apr 11, 10:38 AM
cryptoad marked an inline comment as done.

Aleksey pointed out I was a dash short in the comment. It turns out I copied it
from sanitizer_fuchsia.cc which was also 1 short on each line. So update that
as well, and sanitizer_coverage_fuchsia.cc.

cryptoad added inline comments.Wed, Apr 11, 10:39 AM
lib/sanitizer_common/sanitizer_symbolizer_report.cc
11

So the triple / comes from https://llvm.org/docs/CodingStandards.html#file-headers:
The main body is a doxygen comment (identified by the /// comment marker instead of the usual //) describing the purpose of the file.

cryptoad updated this revision to Diff 142046.Wed, Apr 11, 10:48 AM
cryptoad marked 2 inline comments as done.

Adding /// to all lines of the second section of the header to be LLVM standard
compliant.

cryptoad updated this revision to Diff 142416.Fri, Apr 13, 8:08 AM

Rebasing.

Anyone else for comments?

vitalybuka added inline comments.Fri, Apr 13, 2:59 PM
lib/sanitizer_common/sanitizer_symbolizer_report.cc
21

most of this code was in _libcdep.cc
now its in the file without prefix, so in common file
could this be a problem?

vitalybuka accepted this revision.Fri, Apr 13, 3:00 PM
cryptoad added inline comments.Fri, Apr 13, 3:16 PM
lib/sanitizer_common/sanitizer_symbolizer_report.cc
21

As far as I can tell, this didn't matter anywhere.
I think the _libcdep suffixes could go away for RTSanitizerCommonCoverage & RTSanitizerCommonSymbolizer files if the contract is that they are libc-dependent by nature. The only nolibc consummer that I can see is SafeStack, which depends on neither, so the distinction between libc & nolibc could be reduced to only the core RTSanitizerCommon files.

Once this lands, I can see some added value to consolidating headers & removing dead code as well to see if the distinction can be further reduced.

cryptoad updated this revision to Diff 142634.Mon, Apr 16, 8:01 AM

Rebasing.

This revision was automatically updated to reflect the committed changes.