[compiler-rt] r280885 - [sanitizer] Fix a conflict between abort_on_error and handle_abort.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 10:55:33 PDT 2016


Ah ok I see Kuba's change. Thanks!

On Thu, Sep 8, 2016 at 10:54 AM, Evgenii Stepanov
<eugeni.stepanov at gmail.com> wrote:
> I see this gotsan error on the bot, too. Looking.
> Filipe, I did not get any notification for the osx bots, and the
> current failure looks unrelated. Could you explain why this test
> should not pass?
>
> On Thu, Sep 8, 2016 at 6:43 AM, Filipe Cabecinhas <filcab at gmail.com> wrote:
>> Hi Evgeniy,
>>
>> Did you get this test passing on OS X? AFAICT, OS X will always abort
>> the test before ASan can print that line.
>> There *might* be a configuration difference, but if there is, it is
>> non-obvious and should be documented somewhere visible (possibly on
>> the test too).
>>
>> Thank you,
>>
>>   Filipe
>>
>>
>> On Thu, Sep 8, 2016 at 2:46 AM, Yung, Douglas via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>> Hi Evgeniy,
>>>
>>> This change you made seems to be causing a problem with our internal build bot. I'm seeing the following errors when trying to build your change:
>>>
>>> [74/399] Generating gtest-all.cc.x86_64.o
>>> FAILED: cd /home/siadmin/jenkins/w/opensource/opensource_build/llvm/projects/compiler-rt/lib/tsan/go && env "CC=/usr/bin/cc " IN_TMPDIR=1 SILENT=1 /home/siadmin/jenkins/w/opensource/opensource_build/llvm/projects/compiler-rt/lib/tsan/go/buildgo.sh
>>> /tmp/gotsan.5u5SyTl4ZX/gotsan.cc: In function 'void __sanitizer::Abort()':
>>> /tmp/gotsan.5u5SyTl4ZX/gotsan.cc:10286:12: error: 'struct sigaction' has no member named 'sa_sigaction'
>>>      sigact.sa_sigaction = (sa_sigaction_t)SIG_DFL;
>>>             ^
>>> At global scope:
>>> cc1plus: error: unrecognized command line option "-Wno-unknown-warning-option" [-Werror]
>>> cc1plus: error: unrecognized command line option "-Wno-unused-const-variable" [-Werror]
>>> cc1plus: all warnings being treated as errors
>>> ninja: build stopped: subcommand failed.
>>>
>>>
>>> I'm not sure though where the "unrecognized command line option" errors are coming from though. Can you look into the sigaction error that your change introduced?
>>>
>>> Douglas Yung
>>>
>>>> -----Original Message-----
>>>> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On
>>>> Behalf Of Evgeniy Stepanov via llvm-commits
>>>> Sent: Wednesday, September 07, 2016 16:41
>>>> To: llvm-commits at lists.llvm.org
>>>> Subject: [compiler-rt] r280885 - [sanitizer] Fix a conflict between
>>>> abort_on_error and handle_abort.
>>>>
>>>> Author: eugenis
>>>> Date: Wed Sep  7 18:40:53 2016
>>>> New Revision: 280885
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=280885&view=rev
>>>> Log:
>>>> [sanitizer] Fix a conflict between abort_on_error and handle_abort.
>>>>
>>>> Reset the SIGABRT signal handler before calling abort().
>>>>
>>>> Also, change the error message when catching SIGABRT to say "ABRT"
>>>> instead of "SEGV".
>>>>
>>>> Added:
>>>>     compiler-
>>>> rt/trunk/test/asan/TestCases/Posix/handle_abort_on_error.cc
>>>> Modified:
>>>>     compiler-rt/trunk/lib/asan/asan_posix.cc
>>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>>>>
>>>> Modified: compiler-rt/trunk/lib/asan/asan_posix.cc
>>>> URL: http://llvm.org/viewvc/llvm-project/compiler-
>>>> rt/trunk/lib/asan/asan_posix.cc?rev=280885&r1=280884&r2=280885&view=dif
>>>> f
>>>> =======================================================================
>>>> =======
>>>> --- compiler-rt/trunk/lib/asan/asan_posix.cc (original)
>>>> +++ compiler-rt/trunk/lib/asan/asan_posix.cc Wed Sep  7 18:40:53 2016
>>>> @@ -88,6 +88,8 @@ void AsanOnDeadlySignal(int signo, void
>>>>      ReportDeadlySignal("FPE", sig);
>>>>    else if (signo == SIGILL)
>>>>      ReportDeadlySignal("ILL", sig);
>>>> +  else if (signo == SIGABRT)
>>>> +    ReportDeadlySignal("ABRT", sig);
>>>>    else
>>>>      ReportDeadlySignal("SEGV", sig);
>>>>  }
>>>>
>>>> Modified: compiler-
>>>> rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>>>> URL: http://llvm.org/viewvc/llvm-project/compiler-
>>>> rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=280885&r1=
>>>> 280884&r2=280885&view=diff
>>>> =======================================================================
>>>> =======
>>>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>>>> (original)
>>>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>>>> +++ Wed Sep  7 18:40:53 2016
>>>> @@ -44,6 +44,8 @@
>>>>  #define MAP_NORESERVE 0
>>>>  #endif
>>>>
>>>> +typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
>>>> +
>>>>  namespace __sanitizer {
>>>>
>>>>  u32 GetUid() {
>>>> @@ -126,6 +128,14 @@ void SleepForMillis(int millis) {  }
>>>>
>>>>  void Abort() {
>>>> +  // If we are handling SIGABRT, unhandle it first.
>>>> +  if (IsHandledDeadlySignal(SIGABRT)) {
>>>> +    struct sigaction sigact;
>>>> +    internal_memset(&sigact, 0, sizeof(sigact));
>>>> +    sigact.sa_sigaction = (sa_sigaction_t)SIG_DFL;
>>>> +    internal_sigaction(SIGABRT, &sigact, nullptr);  }
>>>> +
>>>>    abort();
>>>>  }
>>>>
>>>> @@ -170,7 +180,6 @@ void UnsetAlternateSignalStack() {
>>>>    UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);  }
>>>>
>>>> -typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);  static void
>>>> MaybeInstallSigaction(int signum,
>>>>                                    SignalHandlerType handler) {
>>>>    if (!IsHandledDeadlySignal(signum))
>>>>
>>>> Added: compiler-
>>>> rt/trunk/test/asan/TestCases/Posix/handle_abort_on_error.cc
>>>> URL: http://llvm.org/viewvc/llvm-project/compiler-
>>>> rt/trunk/test/asan/TestCases/Posix/handle_abort_on_error.cc?rev=280885&
>>>> view=auto
>>>> =======================================================================
>>>> =======
>>>> --- compiler-
>>>> rt/trunk/test/asan/TestCases/Posix/handle_abort_on_error.cc (added)
>>>> +++ compiler-
>>>> rt/trunk/test/asan/TestCases/Posix/handle_abort_on_error.cc
>>>> +++ Wed Sep  7 18:40:53 2016
>>>> @@ -0,0 +1,9 @@
>>>> +// Regression test: this used to abort() in SIGABRT handler in an
>>>> infinite loop.
>>>> +// RUN: %clangxx_asan -O0 %s -o %t &&
>>>> +%env_asan_opts=handle_abort=1,abort_on_error=1 not --crash %run %t
>>>> 2>&1
>>>> +| FileCheck %s
>>>> +
>>>> +#include <stdlib.h>
>>>> +
>>>> +int main() {
>>>> +  abort();
>>>> +  // CHECK: ERROR: AddressSanitizer: ABRT }
>>>>
>>>>
>>>> _______________________________________________
>>>> 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