[PATCH] D54879: Introduce `LocalAddressSpaceView::LoadWritable(...)` and make the `Load(...)` method return a const pointer.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 25 12:05:24 PST 2018


delcypher created this revision.
delcypher added reviewers: kcc, cryptoad, eugenis, kubamracek, george.karpenkov.
Herald added a subscriber: Sanitizers.

This is a follow-up to r346956 (https://reviews.llvm.org/D53975).

The purpose of this change to allow implementers of the
`AddressSpaceView` to be able to distinguish between when a caller wants
read-only memory and when a caller wants writable memory. Being able
distinguish these cases allows implementations to optimize for the
different cases and also provides a way to workaround possible platform
restrictions (e.g. the low level platform interface for reading
out-of-process memory may place memory in read-only pages).

For allocator enumeration in almost all cases read-only is sufficient so
we make `Load(...)` take on this new requirement and introduce the
`LoadWritable(...)` variants for cases where memory needs to be
writable.

The behaviour of `LoadWritable(...)` documented in comments are
deliberately very restrictive so that it will be possible in the future
to implement a simple write-cache (i.e. just a map from target address
to a writable region of memory). These restrictions can be loosened in
the future if necessary by implementing a more sophisticated
write-cache.

rdar://problem/45284065


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54879

Files:
  lib/sanitizer_common/sanitizer_allocator_secondary.h
  lib/sanitizer_common/sanitizer_local_address_space_view.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54879.175179.patch
Type: text/x-patch
Size: 5078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181125/2da719ec/attachment.bin>


More information about the llvm-commits mailing list