summaryrefslogtreecommitdiffstats
path: root/compiler-rt/include
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2018-08-20 21:49:15 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2018-08-20 21:49:15 +0000
commit4f0e10fff97c3f1beb3ca1ceabcb8f7af6d63c45 (patch)
treed0f54dc6fee8521f1e2b0d8bb293979f7aec1d98 /compiler-rt/include
parente43e2b3667f9bc29c23be5235b53a7d7afcdb181 (diff)
downloadbcm5719-llvm-4f0e10fff97c3f1beb3ca1ceabcb8f7af6d63c45.tar.gz
bcm5719-llvm-4f0e10fff97c3f1beb3ca1ceabcb8f7af6d63c45.zip
[hwasan] Add a (almost) no-interceptor mode.
Summary: 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. Reviewers: vitalybuka, kcc, jfb Subscribers: srhines, kubamracek, mgorny, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D50922 llvm-svn: 340216
Diffstat (limited to 'compiler-rt/include')
-rw-r--r--compiler-rt/include/sanitizer/hwasan_interface.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler-rt/include/sanitizer/hwasan_interface.h b/compiler-rt/include/sanitizer/hwasan_interface.h
index 78644aa9d4f..79bf23e26ff 100644
--- a/compiler-rt/include/sanitizer/hwasan_interface.h
+++ b/compiler-rt/include/sanitizer/hwasan_interface.h
@@ -47,6 +47,14 @@ extern "C" {
// does would cause false reports.
void __hwasan_handle_longjmp(const void *sp_dst);
+ // Libc hook for thread creation. Should be called in the child thread before
+ // any instrumented code.
+ void __hwasan_thread_enter();
+
+ // Libc hook for thread destruction. No instrumented code should run after
+ // this call.
+ void __hwasan_thread_exit();
+
// Print shadow and origin for the memory range to stderr in a human-readable
// format.
void __hwasan_print_shadow(const volatile void *x, size_t size);
OpenPOWER on IntegriCloud