[PATCH] D36239: [sanitizer] Split MmapFixedNoReserve into a version that disallows overwriting existing memory and one that allows it

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 13:32:11 PDT 2017


kubamracek created this revision.
kubamracek added a project: Sanitizers.
Herald added a subscriber: srhines.

Multiple times during work on sanitizers, I've hit a situation where the shadow memory initialization (done via mmap) would overwrite some existing memory.  This patch changes MmapFixedNoReserve to add a safety check to fail when something already occupies the region we're trying to map into, and introduces MmapFixedNoReserveAllowOverwrite which explicitly allows overwriting memory.  Same for MmapFixedNoAccess and MmapFixedNoAccessAllowOverwrite.

The patch implements this for Darwin only currently, but if there's a some Linux and Windows API to do the same, I'll be happy to add them.


Repository:
  rL LLVM

https://reviews.llvm.org/D36239

Files:
  lib/asan/asan_internal.h
  lib/asan/asan_poisoning.h
  lib/asan/asan_shadow_setup.cc
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_linux_libcdep.cc
  lib/sanitizer_common/sanitizer_mac_libcdep.cc
  lib/sanitizer_common/sanitizer_posix_libcdep.cc
  lib/sanitizer_common/sanitizer_win.cc
  lib/tsan/go/buildgo.sh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36239.109405.patch
Type: text/x-patch
Size: 11768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/b701e72c/attachment.bin>


More information about the llvm-commits mailing list