This is an archive of the discontinued LLVM Phabricator instance.

[XRay][compiler-rt] Update use of internal_mmap
ClosedPublic

Authored by dberris on Sep 21 2018, 8:21 AM.

Details

Summary

The implementation of internal_mmap(...) deviates from the contract of
mmap(...) -- i.e. error returns are actually the equivalent of errno
results. We update how XRay uses internal_mmap(...) to better handle
these error conditions.

In the process, we change the default pointers we're using from char*
to uint8_t* to prevent potential usage of the pointers in the string
library functions that expect to operate on char*.

We also take the chance to "promote" sizes of individual internal_mmap
requests to at least page size bytes, consistent with the expectations
of calls to mmap.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Sep 21 2018, 8:21 AM
dberris updated this revision to Diff 166486.Sep 21 2018, 8:23 AM

Update error reporting in one path.

cryptoad added inline comments.Sep 21 2018, 8:28 AM
compiler-rt/lib/xray/xray_allocator.h
125 ↗(On Diff #166486)

There appears to be another use of internal_mmap here with a MAP_FAILED check.

dberris updated this revision to Diff 166489.Sep 21 2018, 8:34 AM
dberris marked an inline comment as done.

Remove another check for MAP_FAILED.

compiler-rt/lib/xray/xray_allocator.h
125 ↗(On Diff #166486)

Good catch, thanks!

cryptoad accepted this revision.Sep 21 2018, 8:46 AM
This revision is now accepted and ready to land.Sep 21 2018, 8:46 AM
This revision was automatically updated to reflect the committed changes.