[PATCH] D85870: sanitizer_common: Introduce internal_madvise and start using it.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 19:56:12 PDT 2020


pcc created this revision.
pcc added a reviewer: eugenis.
Herald added subscribers: Sanitizers, fedor.sergeev.
Herald added a project: Sanitizers.
pcc requested review of this revision.

A recent change to sanitizer_common caused us to issue the syscall
madvise(MADV_HUGEPAGE) during HWASAN initialization. This may lead to a
problem if madvise is instrumented (e.g. because libc is instrumented
or the user intercepted it). For example, on Android the syscall may
fail if the kernel does not support transparent hugepages, which leads
to an attempt to set errno in a HWASAN instrumented function. Avoid
this problem by introducing a syscall wrapper and using it to issue
this syscall.

Tested only on Linux; includes untested updates for the other
platforms.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85870

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_openbsd.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_posix.h
  compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_solaris.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85870.285247.patch
Type: text/x-patch
Size: 5434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/e30ad43f/attachment.bin>


More information about the llvm-commits mailing list