[PATCH] D50922: [hwasan] Add a (almost) no-interceptor mode.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 17 13:48:31 PDT 2018


eugenis created this revision.
eugenis added reviewers: vitalybuka, kcc.
Herald added subscribers: jfb, mgorny, kubamracek, srhines.
Herald added a reviewer: jfb.

The idea behind this change is to allow sanitization of libc. We are prototyping on Bionic,
but the tool interface will be general enough (or at least generalizable) to support any other libc.

When libc depends on libclang_rt.hwasan, the latter can not interpose libc functions.
In fact, majority of interceptors become unnecessary when libc code is instrumented.

This change gets rid of most hwasan interceptors and provides interface for libc to notify
hwasan about thread creation and destruction events. Some interceptors (pthread_create)
are kept under #ifdef to enable testing with uninstrumented libc. They are expressed in
terms of the new libc interface.

The new cmake switch, COMPILER_RT_HWASAN_WITH_INTERCEPTORS, ON by default, builds testing
version of the library with the aforementioned pthread_create interceptor.
With the OFF setting, the library becomes more of a libc plugin.


https://reviews.llvm.org/D50922

Files:
  compiler-rt/CMakeLists.txt
  compiler-rt/include/sanitizer/hwasan_interface.h
  compiler-rt/lib/hwasan/CMakeLists.txt
  compiler-rt/lib/hwasan/hwasan.cc
  compiler-rt/lib/hwasan/hwasan.h
  compiler-rt/lib/hwasan/hwasan_interceptors.cc
  compiler-rt/lib/hwasan/hwasan_interface_internal.h
  compiler-rt/lib/hwasan/hwasan_linux.cc
  compiler-rt/lib/hwasan/hwasan_thread.cc
  compiler-rt/lib/hwasan/hwasan_thread.h
  compiler-rt/test/hwasan/TestCases/longjmp.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50922.161319.patch
Type: text/x-patch
Size: 17422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180817/2b32de49/attachment.bin>


More information about the llvm-commits mailing list