[compiler-rt] r240965 - sanitizer_common: fix and re-enable signal_segv_handler test
Dmitry Vyukov
dvyukov at google.com
Mon Jun 29 09:31:10 PDT 2015
Author: dvyukov
Date: Mon Jun 29 11:31:10 2015
New Revision: 240965
URL: http://llvm.org/viewvc/llvm-project?rev=240965&view=rev
Log:
sanitizer_common: fix and re-enable signal_segv_handler test
struct sigaction was not initialized. As the result if SA_RESETHAND is set in sa_flags, then the handler is reset after first invocation leading to crash.
Initialize struct sigaction to zero.
Reviewed in http://reviews.llvm.org/D10803
Modified:
compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc?rev=240965&r1=240964&r2=240965&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc Mon Jun 29 11:31:10 2015
@@ -13,12 +13,11 @@
// "benign" SEGVs that are handled by signal handler, and ensures that
// the process survive.
-// REQUIRES: disabled
-
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/mman.h>
+#include <string.h>
void *guard;
@@ -28,6 +27,8 @@ void handler(int signo, siginfo_t *info,
int main() {
struct sigaction a, old;
+ memset(&a, 0, sizeof(a));
+ memset(&old, 0, sizeof(old));
a.sa_sigaction = handler;
a.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &a, &old);
More information about the llvm-commits
mailing list