65 Commits

Author SHA1 Message Date
Vitaly Buka
f0f774ebf0
[sanitizer] Rename DEFINE_REAL_PTHREAD_FUNCTIONS (#96527)
We use REAL() calls in interceptors, but
DEFINE_REAL_PTHREAD_FUNCTIONS has nothing to do
with them and only used for internal maintenance
threads.

This is done to avoid confusion like in #96456.
2024-06-25 09:42:01 -07:00
NAKAMURA Takumi
8f86c6bf95 compiler-rt: Fix variadic macro warnings [-Wc++20-extensions]
They began complaining since #84520.
2024-03-26 08:45:12 +09:00
Fangrui Song
fe1d02b08c
[sanitizer] Reject unsupported -static at link time (#83524)
Most sanitizers don't support static linking. One primary reason is the
incompatibility with interceptors. `GetTlsSize` is another reason.
asan/memprof use `__interception::DoesNotSupportStaticLinking`
(`_DYNAMIC` reference) to reject -static at link time. Port this
detector to other sanitizers. dfsan actually supports -static for
certain cases. Don't touch dfsan.
2024-03-12 23:09:36 -07:00
Vitaly Buka
ae6db862a9
[hwasan] Use ErrorAction::Recover in interceptors (#74000) 2023-12-04 15:00:08 -08:00
Vitaly Buka
5fcf3bbb1a [NFC][HWASAN] Remove unused macro parameter 2023-12-02 16:40:14 -08:00
Kirill Stoimenov
4d9f3ca77c
[HWASAN] Add memset interceptor (#71244)
Co-authored-by: Vitaly Buka <vitalybuka@google.com>
2023-11-07 00:01:04 -08:00
Heejin Ahn
d859403037
[sanitizer] Fix pthread_exit interceptor's return type (#71253)
`pthread_exit`'s return type is void.
2023-11-05 22:41:37 -08:00
Kirill Stoimenov
3cf9bf343d
[HWASAN] Enable memcpy and memmove interceptors (#71217) 2023-11-03 14:17:45 -07:00
Vitaly Buka
3e5187ea83 Revert "[HWASAN] Enable memcpy, memmove and memset interceptors (#70387)"
Breaks build bots, details in #70387.

This reverts commit 91cdd7d615da38a1f025646f526c2fce265a37e2.
2023-10-30 21:09:21 -07:00
Kirill Stoimenov
91cdd7d615
[HWASAN] Enable memcpy, memmove and memset interceptors (#70387) 2023-10-30 15:01:21 -07:00
Kirill Stoimenov
46c1671620
[HWASAN]Implement memcmp interceptor in HWASAN (#67204)
The plan is to fix memcmp interceptor in HWASAN and remove the
unsupported statement at that time.

---------

Co-authored-by: Vitaly Buka <vitalybuka@gmail.com>
2023-09-29 16:14:48 -07:00
Thurston Dang
6f11750319 Fix -DCOMPILER_RT_HWASAN_WITH_INTERCEPTORS=OFF regression
This applies the fix as suggested by Gelbpunkt in https://github.com/llvm/llvm-project/issues/64730,

Thanks to Florian Mayer for pointing out that my earlier patch D151262
had caused this regression.

Differential Revision: https://reviews.llvm.org/D158116
2023-08-16 21:35:19 +00:00
Kirill Stoimenov
7ebfc36f7e [Sanitizers] Remove unused parameter from COMMON_INTERCEPTOR_MUNMAP_IMPL
This was a result of copy/paste from the MMAP interceptor which uses the parameter to swtich between mmap and mmap64.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D152980
2023-06-15 23:19:04 +00:00
Vitaly Buka
ad1dd78793 [hwasan] Fixup mmap tagging regions
Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D152893
2023-06-14 15:32:12 -07:00
Kirill Stoimenov
ceab8e3af7 [HWASAN] Fix bot test failure caused by D152763 by switching to
unaligned memory tagging
2023-06-14 14:55:31 +00:00
Kirill Stoimenov
fba9fd1afa [HWASAN] Implement munmap interceptor for HWASAN
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D152763
2023-06-14 05:36:12 +00:00
Marco Elver
0a71e25e24 [compiler-rt] Avoid memintrinsic calls inserted by the compiler
D135716 introduced -ftrivial-auto-var-init=pattern where supported.
Unfortunately this introduces unwanted memset() for large stack arrays,
as shown by the new tests added for asan and msan (tsan already had this
test).

In general, the problem of compiler-inserted memintrinsic calls
(memset/memcpy/memmove) is not new to compiler-rt, and has been a
problem before.

To avoid introducing unwanted memintrinsic calls, we redefine
memintrinsics as __sanitizer_internal_mem* at the assembly level for
most source files automatically (where sanitizer_common_internal_defs.h
is included).

In few cases, redefining a symbol in this way causes issues for
interceptors, namely the memintrinsic interceptor themselves. For such
source files we have to selectively disable the redefinition.

Other alternatives have been considered, but simply do not work well in
the context of compiler-rt:

	1. Linker --wrap:  this does not work because --wrap only
	   applies to the final link, and would not apply when building
	   sanitizer static libraries.

	2. Changing references to memset() via objcopy:  this may work,
	   but due to the complexities of the build system, introducing
	   such a post-processing step for the right object files (in
	   particular object files defining memset cannot be touched)
	   seems infeasible.

The chosen solution works well (as shown by the tests). Other libraries
have chosen the same solution where nothing else works (see e.g. glibc's
"symbol-hacks.h").

v4:
- Add interface attribute to __sanitizer_internal_mem* declarations as
  well, as otherwise some compilers (MSVC) will complain.
- Add SANITIZER_COMMON_NO_REDEFINE_BUILTINS to source files using
  C++STL, since this could lead to ODR violations (see added comment).

v3:
- Don't use ALIAS() to alias internal_mem*() functions to
  __sanitizer_internal_mem*() functions, but just define them as
  ALWAYS_INLINE functions instead. This will work on darwin and windows.

v2:
- Fix ubsan_minimal build where compiler decides to insert
  memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc,
  therefore do not redefine the builtins.
- Fix definition of internal_mem* functions with compilers that want the
  aliased function to already be defined before.
- Fix definition of __sanitizer_internal_mem* functions with compilers
  more pedantic about attribute placement around extern "C".

Reviewed By: vitalybuka, dvyukov

Differential Revision: https://reviews.llvm.org/D151152
2023-06-06 16:10:45 +02:00
Marco Elver
8e54794867 Revert "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"
This reverts commit fc011a72881cdddc95bfa61f3f38916c29b7e362.
This reverts commit 4ad6a0c9a409b19b950a6a2a90d5405cea2e9b89.
This reverts commit 4b1eb4cf0e8eff5f68410720167b4986da597010.

Still causes Windows build bots to fail.
2023-06-02 16:37:38 +02:00
Marco Elver
4b1eb4cf0e [compiler-rt] Avoid memintrinsic calls inserted by the compiler
D135716 introduced -ftrivial-auto-var-init=pattern where supported.
Unfortunately this introduces unwanted memset() for large stack arrays,
as shown by the new tests added for asan and msan (tsan already had this
test).

In general, the problem of compiler-inserted memintrinsic calls
(memset/memcpy/memmove) is not new to compiler-rt, and has been a
problem before.

To avoid introducing unwanted memintrinsic calls, we redefine
memintrinsics as __sanitizer_internal_mem* at the assembly level for
most source files automatically (where sanitizer_common_internal_defs.h
is included).

In few cases, redefining a symbol in this way causes issues for
interceptors, namely the memintrinsic interceptor themselves. For such
source files we have to selectively disable the redefinition.

Other alternatives have been considered, but simply do not work well in
the context of compiler-rt:

	1. Linker --wrap:  this does not work because --wrap only
	   applies to the final link, and would not apply when building
	   sanitizer static libraries.

	2. Changing references to memset() via objcopy:  this may work,
	   but due to the complexities of the build system, introducing
	   such a post-processing step for the right object files (in
	   particular object files defining memset cannot be touched)
	   seems infeasible.

The chosen solution works well (as shown by the tests). Other libraries
have chosen the same solution where nothing else works (see e.g. glibc's
"symbol-hacks.h").

v3:
- Don't use ALIAS() to alias internal_mem*() functions to
  __sanitizer_internal_mem*() functions, but just define them as
  ALWAYS_INLINE functions instead. This will work on darwin and windows.

v2:
- Fix ubsan_minimal build where compiler decides to insert
  memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc,
  therefore do not redefine the builtins.
- Fix definition of internal_mem* functions with compilers that want the
  aliased function to already be defined before.
- Fix definition of __sanitizer_internal_mem* functions with compilers
  more pedantic about attribute placement around extern "C".

Reviewed By: vitalybuka, dvyukov

Differential Revision: https://reviews.llvm.org/D151152
2023-06-02 15:39:00 +02:00
Marco Elver
8e728adcfe Revert "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"
This reverts commit 4369de7af46605522bf7dbe3bc31d00b0eb4bee6.

Fails on Mac OS with "sanitizer_libc.cpp:109:5: error: aliases are not
supported on darwin".
2023-05-31 17:59:11 +02:00
Marco Elver
4369de7af4 [compiler-rt] Avoid memintrinsic calls inserted by the compiler
D135716 introduced -ftrivial-auto-var-init=pattern where supported.
Unfortunately this introduces unwanted memset() for large stack arrays,
as shown by the new tests added for asan and msan (tsan already had this
test).

In general, the problem of compiler-inserted memintrinsic calls
(memset/memcpy/memmove) is not new to compiler-rt, and has been a
problem before.

To avoid introducing unwanted memintrinsic calls, we redefine
memintrinsics as __sanitizer_internal_mem* at the assembly level for
most source files automatically (where sanitizer_common_internal_defs.h
is included).

In few cases, redefining a symbol in this way causes issues for
interceptors, namely the memintrinsic interceptor themselves. For such
source files we have to selectively disable the redefinition.

Other alternatives have been considered, but simply do not work well in
the context of compiler-rt:

	1. Linker --wrap:  this does not work because --wrap only
	   applies to the final link, and would not apply when building
	   sanitizer static libraries.

	2. Changing references to memset() via objcopy:  this may work,
	   but due to the complexities of the build system, introducing
	   such a post-processing step for the right object files (in
	   particular object files defining memset cannot be touched)
	   seems infeasible.

The chosen solution works well (as shown by the tests). Other libraries
have chosen the same solution where nothing else works (see e.g. glibc's
"symbol-hacks.h").

v2:
- Fix ubsan_minimal build where compiler decides to insert
  memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc,
  therefore do not redefine the builtins.
- Fix definition of internal_mem* functions with compilers that want the
  aliased function to already be defined before.
- Fix definition of __sanitizer_internal_mem* functions with compilers
  more pedantic about attribute placement around extern "C".

Reviewed By: vitalybuka, dvyukov

Differential Revision: https://reviews.llvm.org/D151152
2023-05-31 16:58:53 +02:00
Marco Elver
26bda9e95a Revert "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"
This reverts commit e614d5667f6c6fc6c645587cb9aee1a058285454.

Build bot failures:

| FAILED: lib/clang/17/lib/linux/libclang_rt.ubsan_minimal-i386.so
| : && /usr/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -m32 -nodefaultlibs -Wl,-z,text -nostdlib++ -shared -Wl,-soname,libclang_rt.ubsan_minimal-i386.so -o lib/clang/17/lib/linux/libclang_rt.ubsan_minimal-i386.so projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o  -lgcc_s  -lc && :
| /usr/bin/ld: projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o: in function `__ubsan_handle_type_mismatch_minimal':
| /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:120: undefined reference to `__sanitizer_internal_memcpy'
| /usr/bin/ld: projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o: in function `__ubsan_handle_type_mismatch_minimal_abort':
| /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:120: undefined reference to `__sanitizer_internal_memcpy'
| /usr/bin/ld: projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o: in function `__ubsan_handle_alignment_assumption_minimal':
| /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:121: undefined reference to `__sanitizer_internal_memcpy'
| /usr/bin/ld: projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o: in function `__ubsan_handle_alignment_assumption_minimal_abort':
| /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:121: undefined reference to `__sanitizer_internal_memcpy'
| /usr/bin/ld: projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o: in function `__ubsan_handle_add_overflow_minimal':
| /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:122: undefined reference to `__sanitizer_internal_memcpy'
| /usr/bin/ld: projects/compiler-rt/lib/ubsan_minimal/CMakeFiles/RTUbsan_minimal.i386.dir/ubsan_minimal_handlers.cpp.o:/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:122: more undefined references to `__sanitizer_internal_memcpy' follow

Link: https://lab.llvm.org/buildbot#builders/74/builds/19569
2023-05-31 12:20:19 +02:00
Marco Elver
e614d5667f [compiler-rt] Avoid memintrinsic calls inserted by the compiler
D135716 introduced -ftrivial-auto-var-init=pattern where supported.
Unfortunately this introduces unwanted memset() for large stack arrays,
as shown by the new tests added for asan and msan (tsan already had this
test).

In general, the problem of compiler-inserted memintrinsic calls
(memset/memcpy/memmove) is not new to compiler-rt, and has been a
problem before.

To avoid introducing unwanted memintrinsic calls, we redefine
memintrinsics as __sanitizer_internal_mem* at the assembly level for
most source files automatically (where sanitizer_common_internal_defs.h
is included).

In few cases, redefining a symbol in this way causes issues for
interceptors, namely the memintrinsic interceptor themselves. For such
source files we have to selectively disable the redefinition.

Other alternatives have been considered, but simply do not work well in
the context of compiler-rt:

	1. Linker --wrap:  this does not work because --wrap only
	   applies to the final link, and would not apply when building
	   sanitizer static libraries.

	2. Changing references to memset() via objcopy:  this may work,
	   but due to the complexities of the build system, introducing
	   such a post-processing step for the right object files (in
	   particular object files defining memset cannot be touched)
	   seems infeasible.

The chosen solution works well (as shown by the tests). Other libraries
have chosen the same solution where nothing else works (see e.g. glibc's
"symbol-hacks.h").

Reviewed By: vitalybuka, dvyukov

Differential Revision: https://reviews.llvm.org/D151152
2023-05-31 11:50:13 +02:00
Marco Elver
c551c9c311 [compiler-rt] Refactor memintrinsic interceptors
This moves memintrinsic interceptors (memcpy/memmove/memset) into a new
file sanitizer_common_interceptors_memintrinsics.inc.

This is in preparation of redefining builtins, however, we must be
careful to not redefine builtins in TUs that define interceptors of the
same name.

In all cases except for MSan, memintrinsic interceptors were moved to a
new TU $tool_interceptors_memintrinsics.cpp. In the case of MSan, it
turns out this is not yet necessary (as shown by the later patch
introducing memcpy tests).

NFC.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D151552
2023-05-30 11:59:16 +02:00
Vitaly Buka
6c55f4ba57 [NFC][hwasan] Don't copy ThreadStartArg 2023-05-29 23:50:14 -07:00
Thurston Dang
6ce34c089b hwasan: enable mmap interception (no tagging used)
This enables HWASan interception for mmap, to prevent users from allocating in the shadow memory regions. For compatibility, it does not use pointer tagging, nor does it allow MAP_FIXED with a tagged address.

This patch initializes the common interceptors, but that should be a no-op (except for the mmap interceptor), due to the disable-by-default nature of hwasan_platform_interceptors.h (from D150708). As the first patch to utilize this common interceptor machinery for HWASan, it also defines some macros (e.g., COMMON_INTERCEPT_FUNCTION) that will be useful as future interceptors are enabled.

TestCases/Posix/mmap_write_exec.cpp now passes for HWASan.

Reviewed By: kstoimenov, vitalybuka

Differential Revision: D151262
2023-05-26 16:34:10 +00:00
Thurston Dang
d55982ac8c hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]
This patch does the bare minimum to import sanitizer_common_interceptors, but
without actually enabling any interceptors or meaningfully defining the
COMMON_INTERCEPT macros.

This will allow selectively enabling sanitizer_common interceptors (if the
appropriate macros are defined), as suggested by Vitaly in D149701.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D150708
2023-05-23 18:16:46 +00:00
Vitaly Buka
c16fa77c35 [NFC][HWASAN] Fix pthread_attr_getdetachstate use
Luckely of Linux PTHREAD_CREATE_DETACHED is 1.
2023-05-18 01:07:20 -07:00
Thurston Dang
70e0c8ffcb Revert 'hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]'
It was reported in https://reviews.llvm.org/D150708 that my patch has broken
stage2/hwasan check: https://lab.llvm.org/buildbot/#/builders/236/builds/4069

Reverting that patch (and the followup fixes) until I can investigate this further
2023-05-17 20:28:36 +00:00
Thurston Dang
bc9526e30d hwasan: fix buildbot breakage (unused functions)
This addresses another buildbot breakage:
https://lab.llvm.org/buildbot/#/builders/37/builds/22166

My patch, https://reviews.llvm.org/D150708 introduced
stubs for common interceptor macros; these had unused
variables and functions. An earlier patch fixed the
unused variables; this patch suppresses unused-functions
warnings.
2023-05-17 06:15:23 +00:00
Jie Fu
000aeb2499 [hwasan] Fix build breakage (-Wunused-function) in hwasan_interceptors.cpp (NFC)
In file included from /data/llvm-project/compiler-rt/lib/hwasan/hwasan_interceptors.cpp:141:
/data/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common_interceptors.inc:1044:13: error: unused function 'write_iovec' [-Werror,-Wunused-function]
static void write_iovec(void *ctx, struct __sanitizer_iovec *iovec,
            ^
/data/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common_interceptors.inc:1053:13: error: unused function 'read_iovec' [-Werror,-Wunused-function]
static void read_iovec(void *ctx, struct __sanitizer_iovec *iovec,
            ^
/data/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common_interceptors.inc:10363:13: error: unused function 'InitializeCommonInterceptors' [-Werror,-Wunused-function]
static void InitializeCommonInterceptors() {
            ^
3 errors generated.
2023-05-17 13:00:50 +08:00
Thurston Dang
cae7ef2604 hwasan: fix buildbot breakage (unused variables)
This (hopefully) fixes the buildbot breakage:
https://lab.llvm.org/buildbot/#/builders/77/builds/26793

My patch, https://reviews.llvm.org/D150708 introduced
stubs for common interceptor macros; these had unused
variables. This patch suppresses unused-variable
warnings.
2023-05-17 03:22:09 +00:00
Thurston Dang
02a029f7fb hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]
This patch does the bare minimum to import sanitizer_common_interceptors, but
without actually enabling any interceptors or meaningfully defining the
COMMON_INTERCEPT macros.

This will allow selectively enabling sanitizer_common interceptors (if the
appropriate macros are defined), as suggested by Vitaly in D149701.

Differential Revision: https://reviews.llvm.org/D150708
2023-05-16 21:27:25 +00:00
Vitaly Buka
d1aee9c0cb [sanitizers] Remove assert from ThreadArgRetval::Finish
Bionic uses pthread_exit to set retval, when GLIBC does not.
This cause double call to Finish. Rather then tracking this difference
on interceptor size, we can just relax precondition. It does not make
a difference.
2023-05-12 10:15:11 -07:00
Vitaly Buka
68b76af8a4 [HWSAN] Use ThreadArgRetval in HWSAN
Fixes false leaks on thread arg, retval.

Reviewed By: Enna1

Differential Revision: https://reviews.llvm.org/D150166
2023-05-11 15:20:02 -07:00
Vitaly Buka
6fe4621963 [NFC][HWASAN] Use InternalAlloc for ThreadStartArg 2023-05-08 16:33:30 -07:00
Vitaly Buka
82ddf1b8ec [NFC][HWASAN] Move HwasanThreadStartFunc 2023-05-08 16:26:29 -07:00
Vitaly Buka
cc1ed07dc4 [NFC][HWASAN] Reformat the file 2023-05-08 16:26:29 -07:00
Vitaly Buka
f4c43287f2 [NFC][HWASAN] Add more pthread interceptors
They are empty for now. Follow up patches will introduce behaviour
changes.
2023-05-07 16:23:01 -07:00
Vitaly Buka
acecb5dc70 [NFC][HWASAN] Reformat InitializeInterceptors 2023-05-07 16:18:48 -07:00
Thurston Dang
de79b0baa1 [hwasan] Enable common syscall interceptors
This adds the sanitizer_common syscall hooks to HWASan and also defines
the COMMON_SYSCALL_PRE_{READ/WRITE}_RANGE macros.

Differential Revision: https://reviews.llvm.org/D149386
2023-04-27 23:13:29 +00:00
Kirill Stoimenov
7d5e6b4bc7 [HWASAN] Fix TLS + signal handling related crash
When a signal is raised before HWASAN has a chance to initialize it's TLS entry the program crashes. This only happens when hwasan-with-tls is true, which is default value. This patch fixes the problem by disabling signals during thread initialization time.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149085
2023-04-26 18:08:05 +00:00
Kirill Stoimenov
c9258ab7f2 [LSAN] Fix pthread_create interceptor to ignore leaks in real pthread_create.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D143209
2023-02-08 22:55:19 +00:00
Kirill Stoimenov
550cb763da Revert "[LSAN] Fix pthread_create interceptor to ignore leaks in real pthread_create."
This reverts commit a7db3cb257ff6396481f44427bccd0ca5abf4d63.
2023-02-08 21:55:55 +00:00
Kirill Stoimenov
a7db3cb257 [LSAN] Fix pthread_create interceptor to ignore leaks in real pthread_create.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D143209
2023-02-08 20:36:35 +00:00
Kirill Stoimenov
029b410df3 [HWASAN] Set os_id in Thread::Init to make sure that the thread can be found by GetThreadByOsIDLocked.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D143125
2023-02-02 01:42:48 +00:00
Kirill Stoimenov
f2b4b54417 [HWASAN] Init lsan and install at_exit hook
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D141146
2023-01-19 01:40:17 +00:00
Alexey Baturo
38b04fd9c0 [RISC-V][HWASAN] Add runtime support for HWASAN for RISC-V
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D131342
2022-08-28 20:43:31 +03:00
Vitaly Buka
323bfad72d [sanitizer] DEFINE_REAL_PTHREAD_FUNCTIONS for hwasan, lsan, msan
It should be NFC, as they already intercept pthread_create.

This will let us to fix BackgroundThread for these sanitizerts.
In in followup patches I will fix MaybeStartBackgroudThread for them
and corresponding tests.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D114935
2021-12-02 10:24:04 -08:00
Matt Morehouse
750d5fc65c [HWASan] Intercept setjmp/longjmp on x86_64.
Reviewed By: xiangzhangllvm

Differential Revision: https://reviews.llvm.org/D109790
2021-09-17 07:10:57 -07:00