[PATCH] D89993: [GWP-ASan] Refactor memory mapping functions

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 15:54:14 PDT 2020


cryptoad created this revision.
cryptoad added reviewers: hctim, eugenis, mcgrathr.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
cryptoad requested review of this revision.

In preparation for Fuchsia support, this CL refactors the memory
mapping functions.

The new functions are as follows:

- for Freeslots and Metadata: `void *map(size_t Size, const char *Name) const;` `void unmap(void *Ptr, size_t Size) const;`
- for the Pool: `void *reservePool(size_t Size);` `void commitPool(void *Ptr, size_t Size) const;` `void decommitPool(void *Ptr, size_t Size) const;` `void unreservePool();` Note that those don't need a `Name` parameter as those are fixed per function. `{reserve,unreserve}Pool` are not `const` because they will modify platform specific class member on Fuchsia.

I added a plethora of `assert()` as the initial code was not enforcing
page alignment for sizes and addresses, which caused problem in the
initial Fuchsia draft. All sizes should now be properly rounded up to
a page.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89993

Files:
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp
  compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
  compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89993.300118.patch
Type: text/x-patch
Size: 10119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201022/b10bf199/attachment.bin>


More information about the llvm-commits mailing list