[compiler-rt] r217137 - [ASan] allow deadly signals to be received in signal handlers

Alexey Samsonov vonosmas at gmail.com
Thu Sep 4 11:53:17 PDT 2014


This test case fails on Android:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/12591/steps/run%20asan%20lit%20tests%20%5BAndroid%5D/logs/stdio


On Thu, Sep 4, 2014 at 2:34 AM, Alexander Potapenko <glider at google.com>
wrote:

> Author: glider
> Date: Thu Sep  4 04:34:22 2014
> New Revision: 217137
>
> URL: http://llvm.org/viewvc/llvm-project?rev=217137&view=rev
> Log:
> [ASan] allow deadly signals to be received in signal handlers
> (previously ASan would just crash upon the second SEGV)
> Other tools do not use this code yet.
>
>
> Added:
>     compiler-rt/trunk/test/asan/TestCases/zero_page_pc.cc
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
>
> 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=217137&r1=217136&r2=217137&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Thu
> Sep  4 04:34:22 2014
> @@ -148,7 +148,9 @@ static void MaybeInstallSigaction(int si
>    struct sigaction sigact;
>    internal_memset(&sigact, 0, sizeof(sigact));
>    sigact.sa_sigaction = (sa_sigaction_t)handler;
> -  sigact.sa_flags = SA_SIGINFO;
> +  // Do not block the signal from being received in that signal's handler.
> +  // Clients are responsible for handling this correctly.
> +  sigact.sa_flags = SA_SIGINFO | SA_NODEFER;
>    if (common_flags()->use_sigaltstack) sigact.sa_flags |= SA_ONSTACK;
>    CHECK_EQ(0, internal_sigaction(signum, &sigact, 0));
>    VReport(1, "Installed the sigaction for signal %d\n", signum);
>
> Added: compiler-rt/trunk/test/asan/TestCases/zero_page_pc.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/zero_page_pc.cc?rev=217137&view=auto
>
> ==============================================================================
> --- compiler-rt/trunk/test/asan/TestCases/zero_page_pc.cc (added)
> +++ compiler-rt/trunk/test/asan/TestCases/zero_page_pc.cc Thu Sep  4
> 04:34:22 2014
> @@ -0,0 +1,11 @@
> +// Check that ASan correctly detects SEGV on the zero page.
> +// RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s
> +
> +typedef void void_f();
> +int main() {
> +  void_f *func = (void_f *)0x7;
> +  func();
> +  // CHECK: {{AddressSanitizer: SEGV.*(pc.*0007)}}
> +  // CHECK: AddressSanitizer: while reporting a bug found another one.
> Ignoring.
> +  return 0;
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140904/f6678188/attachment.html>


More information about the llvm-commits mailing list