This is an archive of the discontinued LLVM Phabricator instance.

Refactor `AsanChunk` methods into code that supports both in-process and out-of-process examination of `AsanChunk`s.
Needs RevisionPublic

Authored by delcypher on Jan 19 2019, 3:51 PM.

Details

Summary

This refactors the implementations of the Beg(), UsedSize() and
AllocBeg() methods. We do not modify AddrIsInside() because
future patches do not need to use that method in an out-of-process context.

The common code is private and has the Internal suffix. Future
patches will use these new methods in an out-of-process context.

The UsedSizeInternal(...) method takes a new argument
(known_alloc_beg) which allows access to be optimized if the
result of AllocBegInternal() is already known. We will use this
in future patches.

We do not template the AsanChunk type with AddressSpaceView like we did
for the allocators (in previous patches) because it is not possible to
modify the existing methods and preserve the method parameters in
the out-of-process context because we need additional information that the
caller needs to provide. In particular:

  • We need both the address of the copy of the AsanChunk in the local process and its address in the remote process. In the in-process context the this pointer provides both bits of information but this isn't the case in the out-of-process context.
  • We need the address to the ASan allocator in the local process instantiated with the correct AddressSpaceView template. In the in-process context this is just &get_allocator() but in the out-of-process context only the caller knows the address of the copy of the ASan allocator that is instantiated with RemoteAddressSpaceView.

Given the above restrictions this patch refactors the methods into new
methods that take the additional parameters and then modifies the
original methods to provide these additional parameters.

This maximizes code re-use between the in-process and out-of-process use
cases and minimizes the changes required (i.e. none) to existing clients
of AsanChunk.

rdar://problem/45284065

Event Timeline

delcypher created this revision.Jan 19 2019, 3:51 PM
Herald added a subscriber: Restricted Project. · View Herald TranscriptJan 19 2019, 3:51 PM
delcypher edited the summary of this revision. (Show Details)Jan 20 2019, 5:09 AM
delcypher updated this revision to Diff 182697.Jan 20 2019, 5:14 AM

Comment tweak.

delcypher edited the summary of this revision. (Show Details)Jan 20 2019, 8:25 AM
vitalybuka requested changes to this revision.Apr 24 2019, 11:12 AM

Removing stale patches from the "Ready to Review" list.

This revision now requires changes to proceed.Apr 24 2019, 11:12 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 24 2019, 11:12 AM
yln resigned from this revision.Jul 22 2021, 4:13 PM