From 0f92deb81207c80481ff0257fbaba640fe669633 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Mon, 11 Mar 2013 18:07:42 +0000 Subject: [msan] intercept dlopen and clear shadow for it Summary: The loader does not call mmap() through the PLT because it has to bootstrap the process before libc is present. Hooking dlopen() isn't enough either because the loader runs module initializers before returning, and they could run arbitrary msan instrumented code. If msandr is present, then we can intercept the mmaps from dlopen at the syscall layer and clear the shadow there. If msandr is missing, we clear the shadow after dlopen() and hope any initializers are trivial. Reviewers: eugenis CC: kcc, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D509 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@176818 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/msan/msan_interface_internal.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/msan/msan_interface_internal.h') diff --git a/lib/msan/msan_interface_internal.h b/lib/msan/msan_interface_internal.h index 905c5b793..e1cd13c3f 100644 --- a/lib/msan/msan_interface_internal.h +++ b/lib/msan/msan_interface_internal.h @@ -104,6 +104,10 @@ int __msan_get_retval_tls_offset(); SANITIZER_INTERFACE_ATTRIBUTE int __msan_get_param_tls_offset(); +// For intercepting mmap from ld.so in msandr. +SANITIZER_INTERFACE_ATTRIBUTE +bool __msan_is_in_loader(); + // For testing. SANITIZER_INTERFACE_ATTRIBUTE u32 __msan_get_umr_origin(); -- cgit v1.2.3