[all-commits] [llvm/llvm-project] 612e02: [GWP-ASan] Refactor memory mapping functions

Kostya Kortchinsky via All-commits all-commits at lists.llvm.org
Mon Oct 26 13:32:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 612e02ee8c3e8f204378796af2eb526cf5e348f0
      https://github.com/llvm/llvm-project/commit/612e02ee8c3e8f204378796af2eb526cf5e348f0
  Author: Kostya Kortchinsky <kostyak at google.com>
  Date:   2020-10-26 (Mon, 26 Oct 2020)

  Changed paths:
    M compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp
    M compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
    M compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp

  Log Message:
  -----------
  [GWP-ASan] Refactor memory mapping functions

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.

Differential Revision: https://reviews.llvm.org/D89993




More information about the All-commits mailing list