[compiler-rt] r314041 - [lsan] Deadly signal handler for lsan
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 14:41:21 PDT 2017
Are you a 100% sure you've got the right change? This one only touches
the runtime support library, and error by the buildbot link shows a
compiler crash.
On Wed, Sep 27, 2017 at 2:32 PM, Mike Edwards via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Hi Vitaly,
> We are seeing a bot failure with this commit. The particular bot which
> caught this error takes quite some time to run and this was bundled with
> around 50 other commits so I apologize for the amount of time it took to get
> the error to you. The bot failure can be seen here:
>
> http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_build/5097/
>
> I have attached a reproducer to this email and here is the command line
> invocation used to reproduce the issue:
>
> <path to compiler built on r314041>/bin/clang++ -fPIC
> -fvisibility-inlines-hidden -Werror=date-time
> -Werror=unguarded-availability-new -std=c++11 -Wall -W -Wno-unused-parameter
> -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
> -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor
> -Wdelete-non-virtual-dtor -Wstring-conversion -fno-omit-frame-pointer
> -fsanitize=address,undefined -fno-sanitize=vptr,function
> -fno-sanitize-recover=all -fsanitize-address-use-after-scope
> -fcolor-diagnostics -O2 -g -fno-exceptions -fno-rtti -o /dev/null -c
> BinaryStreamError.ii
>
> This bot has been broken for almost 5 days now (this was my fault as it took
> so much time to reproduce the issue) so if you could have a look and get a
> patch up as soon as possible it would be greatly appreciated.
>
> Respectfully,
> Mike Edwards
>
> On Fri, Sep 22, 2017 at 3:57 PM, Vitaly Buka via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: vitalybuka
>> Date: Fri Sep 22 15:57:48 2017
>> New Revision: 314041
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=314041&view=rev
>> Log:
>> [lsan] Deadly signal handler for lsan
>>
>> Summary: Part of https://github.com/google/sanitizers/issues/637
>>
>> Reviewers: eugenis, alekseyshl
>>
>> Subscribers: llvm-commits, dberris, kubamracek, krytarowski
>>
>> Differential Revision: https://reviews.llvm.org/D37608
>>
>> Modified:
>> compiler-rt/trunk/lib/lsan/lsan.cc
>> compiler-rt/trunk/lib/lsan/lsan_interceptors.cc
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>>
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ill.cc
>>
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
>>
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fpe.cc
>>
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc
>>
>> Modified: compiler-rt/trunk/lib/lsan/lsan.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/lsan/lsan.cc (original)
>> +++ compiler-rt/trunk/lib/lsan/lsan.cc Fri Sep 22 15:57:48 2017
>> @@ -65,6 +65,18 @@ static void InitializeFlags() {
>> if (common_flags()->help) parser.PrintFlagDescriptions();
>> }
>>
>> +static void OnStackUnwind(const SignalContext &sig, const void *,
>> + BufferedStackTrace *stack) {
>> + GetStackTraceWithPcBpAndContext(stack, kStackTraceMax, sig.pc, sig.bp,
>> + sig.context,
>> + common_flags()->fast_unwind_on_fatal);
>> +}
>> +
>> +void LsanOnDeadlySignal(int signo, void *siginfo, void *context) {
>> + HandleDeadlySignal(siginfo, context, GetCurrentThread(),
>> &OnStackUnwind,
>> + nullptr);
>> +}
>> +
>> extern "C" void __lsan_init() {
>> CHECK(!lsan_init_is_running);
>> if (lsan_inited)
>> @@ -80,6 +92,7 @@ extern "C" void __lsan_init() {
>> InitTlsSize();
>> InitializeInterceptors();
>> InitializeThreadRegistry();
>> + InstallDeadlySignalHandlers(LsanOnDeadlySignal);
>> u32 tid = ThreadCreate(0, 0, true);
>> CHECK_EQ(tid, 0);
>> ThreadStart(tid, GetTid());
>>
>> Modified: compiler-rt/trunk/lib/lsan/lsan_interceptors.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_interceptors.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/lsan/lsan_interceptors.cc (original)
>> +++ compiler-rt/trunk/lib/lsan/lsan_interceptors.cc Fri Sep 22 15:57:48
>> 2017
>> @@ -401,9 +401,14 @@ INTERCEPTOR(void, _exit, int status) {
>> REAL(_exit)(status);
>> }
>>
>> +#define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)
>> +#include "sanitizer_common/sanitizer_signal_interceptors.inc"
>> +
>> namespace __lsan {
>>
>> void InitializeInterceptors() {
>> + InitializeSignalInterceptors();
>> +
>> INTERCEPT_FUNCTION(malloc);
>> INTERCEPT_FUNCTION(free);
>> LSAN_MAYBE_INTERCEPT_CFREE;
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Fri Sep 22
>> 15:57:48 2017
>> @@ -318,15 +318,24 @@ void SetSoftRssLimitExceededCallback(voi
>> typedef void (*SignalHandlerType)(int, void *, void *);
>> HandleSignalMode GetHandleSignalMode(int signum);
>> void InstallDeadlySignalHandlers(SignalHandlerType handler);
>> +
>> // Signal reporting.
>> -void StartReportDeadlySignal();
>> // Each sanitizer uses slightly different implementation of stack
>> unwinding.
>> typedef void (*UnwindSignalStackCallbackType)(const SignalContext &sig,
>> const void
>> *callback_context,
>> BufferedStackTrace *stack);
>> +// Print deadly signal report and die.
>> +void HandleDeadlySignal(void *siginfo, void *context, u32 tid,
>> + UnwindSignalStackCallbackType unwind,
>> + const void *unwind_context);
>> +
>> +// Part of HandleDeadlySignal, exposed for asan.
>> +void StartReportDeadlySignal();
>> +// Part of HandleDeadlySignal, exposed for asan.
>> void ReportDeadlySignal(const SignalContext &sig, u32 tid,
>> UnwindSignalStackCallbackType unwind,
>> const void *unwind_context);
>> +
>> // Alternative signal stack (POSIX-only).
>> void SetAlternateSignalStack();
>> void UnsetAlternateSignalStack();
>>
>> Modified:
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc Fri
>> Sep 22 15:57:48 2017
>> @@ -254,6 +254,18 @@ void ReportDeadlySignal(const SignalCont
>> else
>> ReportDeadlySignalImpl(sig, tid, unwind, unwind_context);
>> }
>> +
>> +void HandleDeadlySignal(void *siginfo, void *context, u32 tid,
>> + UnwindSignalStackCallbackType unwind,
>> + const void *unwind_context) {
>> + StartReportDeadlySignal();
>> + ScopedErrorReportLock rl;
>> + SignalContext sig(siginfo, context);
>> + ReportDeadlySignal(sig, tid, unwind, unwind_context);
>> + Report("ABORTING\n");
>> + Die();
>> +}
>> +
>> #endif // !SANITIZER_FUCHSIA && !SANITIZER_GO
>>
>> void WriteToSyslog(const char *msg) {
>>
>> Modified:
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> ---
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
>> (original)
>> +++
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
>> Fri Sep 22 15:57:48 2017
>> @@ -18,7 +18,6 @@
>> // clang-format on
>>
>> // Remove when fixed: https://github.com/google/sanitizers/issues/637
>> -// XFAIL: lsan
>> // XFAIL: msan
>> // XFAIL: tsan
>> // XFAIL: ubsan
>>
>> Modified:
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc
>> (original)
>> +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/assert.cc Fri
>> Sep 22 15:57:48 2017
>> @@ -7,11 +7,11 @@
>> // RUN: %env_tool_opts=handle_abort=1 not %run %t 2>&1 |
>> FileCheck --check-prefix=CHECK1 %s
>> // clang-format on
>>
>> -// FIXME: implement in other sanitizers, not just asan.
>> +// FIXME: implement in other sanitizers.
>> // XFAIL: msan
>> -// XFAIL: lsan
>> // XFAIL: tsan
>> // XFAIL: ubsan
>> +
>> #include <assert.h>
>> #include <stdio.h>
>> #include <sanitizer/asan_interface.h>
>>
>> Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ill.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ill.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ill.cc
>> (original)
>> +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ill.cc Fri Sep
>> 22 15:57:48 2017
>> @@ -7,9 +7,8 @@
>> // RUN: %env_tool_opts=handle_sigill=1 not %run %t 2>&1 |
>> FileCheck --check-prefix=CHECK1 %s
>> // clang-format on
>>
>> -// FIXME: implement in other sanitizers, not just asan.
>> +// FIXME: implement in other sanitizers.
>> // XFAIL: msan
>> -// XFAIL: lsan
>> // XFAIL: tsan
>> // XFAIL: ubsan
>> //
>>
>> Modified:
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> ---
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
>> (original)
>> +++
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
>> Fri Sep 22 15:57:48 2017
>> @@ -9,7 +9,6 @@
>> // REQUIRES: stable-runtime
>> // FIXME: implement SEGV handler in other sanitizers, not just asan.
>> // XFAIL: msan
>> -// XFAIL: lsan
>> // XFAIL: tsan
>> // XFAIL: ubsan
>>
>>
>> Modified:
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> ---
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc
>> (original)
>> +++
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/dump_instruction_bytes.cc
>> Fri Sep 22 15:57:48 2017
>> @@ -8,7 +8,10 @@
>> // clang-format on
>>
>> // REQUIRES: x86-target-arch
>> -// XFAIL: lsan, msan, tsan, ubsan
>> +// FIXME: implement in other sanitizers.
>> +// XFAIL: msan
>> +// XFAIL: tsan
>> +// XFAIL: ubsan
>>
>> int main() {
>> #if defined(__x86_64__)
>>
>> Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fpe.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fpe.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fpe.cc
>> (original)
>> +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fpe.cc Fri Sep
>> 22 15:57:48 2017
>> @@ -5,7 +5,6 @@
>> // RUN: %env_tool_opts=handle_sigfpe=1 not %run %t 2>&1 |
>> FileCheck --check-prefix=CHECK1 %s
>> // FIXME: implement in other sanitizers, not just asan.
>> // XFAIL: msan
>> -// XFAIL: lsan
>> // XFAIL: tsan
>> // XFAIL: ubsan
>> //
>>
>> Modified:
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc?rev=314041&r1=314040&r2=314041&view=diff
>>
>> ==============================================================================
>> ---
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc
>> (original)
>> +++
>> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc
>> Fri Sep 22 15:57:48 2017
>> @@ -8,7 +8,6 @@
>> // XFAIL: android && i386-target-arch && asan
>> // FIXME: implement SEGV handler in other sanitizers, not just asan.
>> // XFAIL: msan
>> -// XFAIL: lsan
>> // XFAIL: tsan
>> // XFAIL: ubsan
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list