This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer][fuchsia] Implement ReleaseMemoryPagesToOS
ClosedPublic

Authored by charco on Jan 25 2021, 11:54 AM.

Details

Summary

The zx_vmar_op_range allows us to decommit memory pages without
needing a handle to the underlying vmo, as long as we have a handle to
a vmar that contains this mapping. This allows us to implement the
ReleaseMemoryPagesToOS function by decommitting the memory using a
handle to the root vmar.

Diff Detail

Event Timeline

charco requested review of this revision.Jan 25 2021, 11:54 AM
charco created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2021, 11:54 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
charco added inline comments.Jan 25 2021, 12:20 PM
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
393

Note that this will crash if zx_vmar_op_range fails, which is something that the other implementations don't check.

mcgrathr accepted this revision.Jan 25 2021, 1:35 PM

lgtm. I think it should only fail if the VMAR handle is bad or doesn't have WRITE rights or if the address range includes non-writable mappings. I think panic is desirable for those cases.

This revision is now accepted and ready to land.Jan 25 2021, 1:35 PM
This revision was automatically updated to reflect the committed changes.