This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Cleanup ReadFileToVector and ReadFileToBuffer
ClosedPublic

Authored by vitalybuka on May 8 2018, 6:17 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

vitalybuka created this revision.May 8 2018, 6:17 PM
morehouse added inline comments.May 10 2018, 5:57 PM
compiler-rt/lib/sanitizer_common/sanitizer_common.h
647 ↗(On Diff #145835)

Why is it implemented this way rather than copying over the bytes that have already been read?

compiler-rt/lib/sanitizer_common/sanitizer_file.cc
97 ↗(On Diff #146060)

This function looks much better than before, but since we're already modifying this maybe it would make sense to copy data over to the new mmapped region rather than rereading it.

vitalybuka added inline comments.Jun 5 2018, 11:31 AM
compiler-rt/lib/sanitizer_common/sanitizer_common.h
647 ↗(On Diff #145835)

Updated comment.

compiler-rt/lib/sanitizer_common/sanitizer_file.cc
97 ↗(On Diff #146060)

we can't as we want to discard results after each short read for proc maps

morehouse accepted this revision.Jun 5 2018, 4:25 PM
This revision is now accepted and ready to land.Jun 5 2018, 4:25 PM

Just found https://github.com/google/sanitizers/issues/435 and https://chromiumcodereview.appspot.com/18661009.

Maybe it would make sense to write a separate function for reading procmaps.

vitalybuka added a comment.EditedJun 6 2018, 1:26 PM

Just found https://github.com/google/sanitizers/issues/435 and https://chromiumcodereview.appspot.com/18661009.

Maybe it would make sense to write a separate function for reading procmaps.

That's the plan.
I'll switch all non-procmaps callers to ReadFileToVector and then rename/hide ReadFileToBuffer to something procmaps specific.

This revision was automatically updated to reflect the committed changes.