Commit Graph

71 Commits

Author SHA1 Message Date
Ehsan Akhgari 911ea4e2be Add support for intercepting thunks of the form
llvm-svn: 212979
2014-07-14 20:28:21 +00:00
Viktor Kutuzov f294f25d3a Make sanitizers' interceptors non-weak on FreeBSD
Differential Revision: http://reviews.llvm.org/D4418

llvm-svn: 212693
2014-07-10 09:16:58 +00:00
Timur Iskhodzhanov cbee13e04c [Sanitizer/interception Win] Break into the debugger on unknown instructions
llvm-svn: 210028
2014-06-02 13:40:41 +00:00
Timur Iskhodzhanov 51fadc387a [ASan Win] Fix memset interception in DLLs
llvm-svn: 210027
2014-06-02 13:23:42 +00:00
Timur Iskhodzhanov 0c7c78f1d1 [ASan/Win] Use the new function interception approach to handle function wrappers too; wrap strlen() in DLLs
Reviewed at http://reviews.llvm.org/D3871

llvm-svn: 209427
2014-05-22 12:03:40 +00:00
Timur Iskhodzhanov 37c00b4b19 [ASan/Win] Refactor __interception::OverrideFunction a bit, allow the orig_old_func parameter to be zero
Reviewed at http://reviews.llvm.org/D3798

llvm-svn: 208989
2014-05-16 14:04:57 +00:00
Kostya Serebryany 04f2bf0f07 [sanitizer] Interception macros for sanitizers on FreeBSD; patch by Viktor Kutuzov
llvm-svn: 202009
2014-02-24 08:37:41 +00:00
Alexey Samsonov b73db72a17 [CMake] Simplify setting compile flag disabling RTTI
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Timur Iskhodzhanov 00aa75b774 Move /FS to SANITIZER_COMMON_CFLAGS
llvm-svn: 200485
2014-01-30 19:48:13 +00:00
Timur Iskhodzhanov 5b56093acc Quick-fix a typo
llvm-svn: 200483
2014-01-30 19:19:47 +00:00
Timur Iskhodzhanov 45849098eb Add an /FS flag to the lib/interception CMake to make it buildable with VS2013 too
llvm-svn: 200482
2014-01-30 19:19:29 +00:00
Timur Iskhodzhanov 50672ac9cb Add support for more instruction prefixes so we can intercept functions in the VS2013 RTL
llvm-svn: 200366
2014-01-29 02:00:58 +00:00
Evgeniy Stepanov 66297cac72 [msan] Wrap indirect calls to REAL(x) in interceptors.
llvm-svn: 197806
2013-12-20 12:20:15 +00:00
Alexey Samsonov 5ca3de6e91 PR16532: work around old GCC bug in interception_type_test.cc
llvm-svn: 196506
2013-12-05 13:29:46 +00:00
Evgeniy Stepanov 90e12a6cb2 [sanitizer] Avoid needless use of stringification (#symver) in INTERCEPT_FUNCTION_VER.
This is a workaround for clang-format bug (PR17874).

llvm-svn: 194468
2013-11-12 10:21:52 +00:00
Alexander Potapenko 49034e3c33 [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib

The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code.

The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime.

llvm-svn: 194199
2013-11-07 10:08:19 +00:00
Alexey Samsonov edecc38395 Make some pthread_mutex_* and pthread_cond_* interceptors common.
Reviewers: eugenis, dvyukov

Reviewed By: dvyukov

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1937

llvm-svn: 192774
2013-10-16 08:20:31 +00:00
Dmitry Vyukov b523b9c8d4 tsan: fix linking of tsan runtime into dynamic libraries
versioned symbols can not be linked into dynamic library w/o linker script
also simplifies code as side effect

llvm-svn: 191056
2013-09-19 23:44:51 +00:00
Timur Iskhodzhanov 92702d8401 [ASan] Remove the explicit function prototypes for intercepted functions on Windows
llvm-svn: 190411
2013-09-10 14:42:15 +00:00
Dmitry Vyukov e2391f66f9 tsan: fix linking when -ltsan is passed before -lpthread
libpthread is weird:
/lib/x86_64-linux-gnu/libpthread.so.0:000000000000b9b0 T pthread_cond_init@@GLIBC_2.3.2
/lib/x86_64-linux-gnu/libpthread.so.0:000000000000c720 T pthread_cond_init@GLIBC_2.2.5
let's do it with @@ for now
we can always introduce more macros parameters later

llvm-svn: 189788
2013-09-03 10:16:44 +00:00
Dmitry Vyukov 23b80ab87f asan: fix android build
android does not have dlvsym

llvm-svn: 189781
2013-09-03 07:53:49 +00:00
Dmitry Vyukov 3a6c7cea77 tsan: properly intercept pthread_cond functions
llvm-svn: 189767
2013-09-02 18:06:28 +00:00
Alexander Potapenko a15d49cc1f [libsanitizer] Introduce INTERCEPTOR_WITH_SUFFIX which is to be used for appending the __DARWIN_ALIAS() version suffixes to function names on Darwin.
This should fix asan/lit_tests/wait.cc under ASan.

llvm-svn: 182259
2013-05-20 13:32:35 +00:00
Kostya Serebryany f0b8f989e9 add Linux syscall wrappers and ThreadLister to sanitizer_common
ThreadLister is a Linux-specific class for obtaining the thread IDs of a process from procfs (/proc/<pid>/task/). It will be used by leak checking code.
Also add several syscall wrappers which will be required by the same code that uses ThreadLister, but are not used in ThreadLister itself.
Patch by Sergey Matveev

llvm-svn: 176179
2013-02-27 11:22:40 +00:00
Alexander Potapenko e8ba1c851a [ASan] Refactoring: nuke the redundant function declarations in asan_intercepted_functions.h
that had been used on OS X only.
The INTERCEPTOR() macro on OS X is now responsible for declaring the wrapped function, the wrapper and the
pair of pointers to them in __DATA,__interposition section. Thus adding an interceptor requires editing a single file now.

llvm-svn: 175740
2013-02-21 14:41:16 +00:00
Kostya Serebryany 039fa75e4d [asan] fix x32 build (H.J. Lu)
llvm-svn: 175140
2013-02-14 08:05:55 +00:00
Evgeniy Stepanov 4ea6816247 [sanitizer] OFF_T on Mac is u64.
llvm-svn: 174600
2013-02-07 09:52:43 +00:00
Evgeniy Stepanov 44f083d49b [sanitizer] Exclude off64_t test on mac.
llvm-svn: 174598
2013-02-07 09:34:08 +00:00
Alexey Samsonov b788512d11 [Sanitizer] include stddef.h for ptrdiff_t in interception type test
llvm-svn: 174597
2013-02-07 09:03:01 +00:00
Evgeniy Stepanov 3e3d0be7de [sanitizer] Add a missing header.
llvm-svn: 174594
2013-02-07 07:43:41 +00:00
Evgeniy Stepanov 8268785f44 [sanitizer] Fix wrong size of OFF_T on 32-bit platforms.
This broke pread/pwrite interceptors when building without
-D_FILE_OFFSET_BITS=64, and always on Android.

llvm-svn: 174593
2013-02-07 07:37:12 +00:00
Alexander Potapenko 34157fc33f [ASan] Delete the code related to static runtime on OS X.
Nuke lib/interception/mach_override.

llvm-svn: 174383
2013-02-05 15:57:12 +00:00
Alexey Samsonov 32832e6176 [Sanitizer] include sanitizer_common headers when building interception library
llvm-svn: 173930
2013-01-30 14:27:41 +00:00
Evgeniy Stepanov 358698279d [sanitizer] Further split private and public sanitizer headers.
And make msan_interface.h C-compatible.

llvm-svn: 173928
2013-01-30 13:12:08 +00:00
Alexey Samsonov 4e50333684 CMake: Add add_compiler_rt_osx_object_library to create universal libraries on Mac
llvm-svn: 172979
2013-01-20 14:36:12 +00:00
Alexey Samsonov b068483d4d CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
llvm-svn: 172829
2013-01-18 16:51:07 +00:00
Alexey Samsonov 163ab9d0a5 CMake: create AddCompilerRT module and implement convenience add_compiler_rt_object_library function
llvm-svn: 172826
2013-01-18 16:05:21 +00:00
Alexey Samsonov 193b45f4fe CMake variables renaming: X86_64->x86_64 I386->i386
llvm-svn: 172812
2013-01-18 12:45:44 +00:00
Evgeniy Stepanov 222076e972 [sanitizer] Common *scanf interceptors.
llvm-svn: 172805
2013-01-18 11:17:23 +00:00
Kostya Serebryany 07bb3925b0 [sanitizer] replace size_t with SIZE_T in interceptors (same for ssize_t, off_t and off64_t). This is done to avoid confusion and to make the code work with compilers that define size_t w/o any includes (MSVC)
llvm-svn: 170103
2012-12-13 06:31:40 +00:00
Alexander Potapenko 4d533d243d [ASan] Add the "lea $imm(%rip),%rax" instruction to mach_override.c
The need for this has been reported by Jack Howarth (howarth@bromo.med.uc.edu) who's porting ASan-Darwin to GCC

llvm-svn: 168032
2012-11-15 08:32:16 +00:00
Alexey Samsonov a555b3faf4 [ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the same time, remove ASan from CMake build on Windows after conversation with Timur. We don't want to support building ASan on Windows until it is in a working state.
llvm-svn: 164486
2012-09-24 11:43:40 +00:00
Alexander Potapenko c7a7522f83 Pass -std=c99 when compiling mach_override.c
llvm-svn: 163717
2012-09-12 15:44:56 +00:00
Alexander Potapenko dff254c534 Fix compiler warnings: remove __attribute__((visibility)) for static functions, use unsigned char instead of char.
llvm-svn: 163707
2012-09-12 14:14:08 +00:00
Alexey Samsonov 4787d0fbef [ASan] more macro/casting magic to suppress warnings
llvm-svn: 163706
2012-09-12 14:10:14 +00:00
Alexey Samsonov e413ad99ac [Sanitizer] Fix compiler warnings (including void* arithmetic) in mach_override
llvm-svn: 163698
2012-09-12 10:45:36 +00:00
Alexey Samsonov a81d268acd [ASan] fix interception macro for Android build
llvm-svn: 163692
2012-09-12 09:42:23 +00:00
Alexey Samsonov 788eaeb35b [Sanitizer] get rid of empty DEFAULT_CONVENTION in interception lib to remove empty macro arguments
llvm-svn: 163622
2012-09-11 15:02:20 +00:00
Evgeniy Stepanov 1a8f8fa6c0 CMake build rules for ASan Android runtime and tests.
llvm-svn: 163613
2012-09-11 11:55:45 +00:00
Alexander Potapenko 447ff70280 Add "movsbl %dh, %ecx" and "testb %r8, %r8" to mach_override.
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=105

llvm-svn: 163301
2012-09-06 09:38:27 +00:00