Commit Graph

12 Commits

Author SHA1 Message Date
Vitaly Buka d48f2d7c02 [sanitizer] Cleanup -Wnon-virtual-dtor warnings 2020-11-02 20:30:50 -08:00
Vitaly Buka cd13476ab5 [NFC][LSAN] Change SuspendedThreadsList interface
Remove RegisterCount and let GetRegistersAndSP to resize buffer as needed.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D87747
2020-09-16 14:01:27 -07:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Francis Ricci 5989dd241e Update suspended threads info to be compatible with darwin
Summary:
On Darwin, we need to track thread and tid as separate values.
This patch splits out the implementation of the suspended threads list
to be OS-specific.

Reviewers: glider, kubamracek, kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31474

llvm-svn: 300491
2017-04-17 20:29:38 +00:00
Kuba Mracek ceb30b0717 [sanitizer] Introduce tid_t as a typedef for OS-provided thread IDs
We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD).

Differential Revision: https://reviews.llvm.org/D31774

llvm-svn: 300473
2017-04-17 18:17:38 +00:00
Maxim Ostapenko fe863a6510 [lsan] Avoid segfaults during threads destruction under high load
This patch addresses two issues:

	* It turned out that suspended thread may have dtls->dtv_size == kDestroyedThread (-1)
	and LSan wrongly assumes that DTV is available. This leads to SEGV when LSan tries to
	iterate through DTV that is invalid.
	* In some rare cases GetRegistersAndSP can fail with errno 3 (ESRCH). In this case LSan
	assumes that the whole stack of a given thread is available. This is wrong because ESRCH
	can indicate that suspended thread was destroyed and its stack was unmapped. This patch
	properly handles ESRCH from GetRegistersAndSP in order to avoid invalid accesses to already
	unpapped threads stack.

Differential Revision: https://reviews.llvm.org/D30818

llvm-svn: 299630
2017-04-06 07:42:27 +00:00
Dmitry Vyukov 0fc13a9a82 asan: fix comment formatting
As per comments in http://reviews.llvm.org/D8032

llvm-svn: 231457
2015-03-06 08:43:44 +00:00
Dmitry Vyukov 72f169797e tsan: fix signal handling during stop-the-world
Long story short: stop-the-world briefly resets SIGSEGV handler to SIG_DFL.
This breaks programs that handle and continue after SIGSEGV (namely JVM).
See the test and comments for details.

This is reincarnation of reverted r229678 (http://reviews.llvm.org/D7722).
Changed:
- execute TracerThreadDieCallback only on tracer thread
- reset global data in TracerThreadSignalHandler/TracerThreadDieCallback
- handle EINTR from waitpid

Add 3 new test:
- SIGSEGV during leak checking
- StopTheWorld operation during signal storm from an external process
- StopTheWorld operation when the program generates and handles SIGSEGVs

http://reviews.llvm.org/D8032

llvm-svn: 231367
2015-03-05 14:37:28 +00:00
Alexey Samsonov b0d92b3312 [Sanitizer] Rename InternalVector to InternalMmapVector
llvm-svn: 183972
2013-06-14 09:59:40 +00:00
Alexander Potapenko 9cc2e436bb [libsanitizer] Add register dumping support to SuspendedThreadsList.
An interface for obtaining register contexts from suspended threads. Tailored
for LSan use.

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 178461
2013-04-01 13:36:42 +00:00
Alexey Samsonov f9dbbda5bc [Sanitizer] Get rid of global mutexes in StopTheWorld implementation
llvm-svn: 177246
2013-03-18 06:27:13 +00:00
Alexander Potapenko 845b575370 [libsanitizer] StopTheWorld in sanitizer_common
StopTheWorld puts the process in a suspended state before running the
user-supplied callback. To be used in TSan and in leak checking code.

Linux implementation provided.

Patch by Sergey Matveev (earthdok@google.com)

llvm-svn: 177156
2013-03-15 14:37:21 +00:00