This is an archive of the discontinued LLVM Phabricator instance.

[XRay][compiler-rt] FDR Mode: Use mmap instead of internal allocator
ClosedPublic

Authored by dberris on Jul 29 2018, 8:31 PM.

Details

Summary

This change moves FDR mode to use internal_mmap(...) from
sanitizer_common instead of the internal allocator interface. We're
doing this to sidestep the alignment issues we encounter with the
InternalAlloc(...) functions returning pointers that have some magic
bytes at the beginning.

XRay copies bytes into the buffer memory, and does not require the magic
bytes tracking the other sanitizers use when allocating/deallocating
buffers.

Event Timeline

dberris created this revision.Jul 29 2018, 8:31 PM
dberris updated this revision to Diff 157912.Jul 29 2018, 10:03 PM

Use -1 for fd, according to mmap's manpage for portable implementations.

dberris updated this revision to Diff 157914.Jul 29 2018, 10:27 PM

Add comment on why we're using MAP_NORESERVE in the XRay buffer queue implementation.

devnexen added inline comments.
compiler-rt/lib/xray/xray_buffer_queue.cc
24

Wout it be useful to "refactor" it somewhere as it s already present in away_allocator ?

dberris added inline comments.Jul 29 2018, 10:45 PM
compiler-rt/lib/xray/xray_buffer_queue.cc
24

It could be, I suspect it's something worth doing in sanitizer_common/sanitizer_posix.h instead. Can do that as a follow-up.

eizan accepted this revision.Jul 29 2018, 10:50 PM
This revision is now accepted and ready to land.Jul 29 2018, 10:50 PM
This revision was automatically updated to reflect the committed changes.