This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizer] Fix report_path functionality:
ClosedPublic

Authored by samsonov on Dec 10 2014, 4:44 PM.

Details

Summary
  • Make sure mmap() is never called inside RawWrite function.
  • Wrap a bunch of standalone globals in a ReportFile object.
  • Make sure accesses to these globals are thread-safe.
  • Fix report_path functionality on Windows, where __sanitizer_set_report_path() would break program.

I've started this yak shaving in order to make
"CommonFlags::mmap_limit_mb" immutable. Currently we drop this flag
to zero before printing an error message.

Diff Detail

Repository
rL LLVM

Event Timeline

samsonov updated this revision to Diff 17129.Dec 10 2014, 4:44 PM
samsonov retitled this revision from to [Sanitizer] Fix report_path functionality:.
samsonov updated this object.
samsonov edited the test plan for this revision. (Show Details)
samsonov added reviewers: kcc, glider.
samsonov added a subscriber: Unknown Object (MLST).
glider accepted this revision.Dec 11 2014, 5:39 AM
glider edited edge metadata.

Looks generally good, and thanks for the cleanup.

lib/sanitizer_common/sanitizer_common.h
133 ↗(On Diff #17129)

Spare newline?

158 ↗(On Diff #17129)

Are you planning to access these fields from outside ReportFile?
Looks like they can be made private now.

lib/sanitizer_common/sanitizer_win.cc
495 ↗(On Diff #17129)

Isn't this function supposed to die?

This revision is now accepted and ready to land.Dec 11 2014, 5:39 AM
samsonov updated this revision to Diff 17181.Dec 11 2014, 10:18 AM
samsonov edited edge metadata.

Address review comments.

samsonov added inline comments.Dec 11 2014, 10:22 AM
lib/sanitizer_common/sanitizer_common.h
133 ↗(On Diff #17129)

Fixed

158 ↗(On Diff #17129)

I can't make them private, because I need aggregate initialization for global ReportFile object (we're not allowed to have global constructors in the runtime). I'll leave a comment about that.

lib/sanitizer_common/sanitizer_win.cc
495 ↗(On Diff #17129)

Alright, seems that closed fd is a normal situation on the Windows. Renamed this function.

This revision was automatically updated to reflect the committed changes.