summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc3
-rw-r--r--compiler-rt/test/msan/ptrace.cc7
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index cd1b189a9cb..fdc400d0ca0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -289,7 +289,8 @@ namespace __sanitizer {
int ptrace_setfpregs = PTRACE_SETFPREGS;
int ptrace_getfpxregs = PTRACE_GETFPXREGS;
int ptrace_setfpxregs = PTRACE_SETFPXREGS;
-#if defined(PTRACE_GETSIGINFO) && defined(PTRACE_SETSIGINFO)
+#if (defined(PTRACE_GETSIGINFO) && defined(PTRACE_SETSIGINFO)) || \
+ (defined(PT_GETSIGINFO) && defined(PT_SETSIGINFO))
int ptrace_getsiginfo = PTRACE_GETSIGINFO;
int ptrace_setsiginfo = PTRACE_SETSIGINFO;
#else
diff --git a/compiler-rt/test/msan/ptrace.cc b/compiler-rt/test/msan/ptrace.cc
index 1dd4fae2970..36cd03f7bb1 100644
--- a/compiler-rt/test/msan/ptrace.cc
+++ b/compiler-rt/test/msan/ptrace.cc
@@ -1,6 +1,7 @@
// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
#include <assert.h>
+#include <signal.h>
#include <stdio.h>
#include <sys/ptrace.h>
#include <sys/types.h>
@@ -29,7 +30,13 @@ int main(void) {
if (fpregs.mxcsr)
printf("%x\n", fpregs.mxcsr);
+ siginfo_t siginfo;
+ res = ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo);
+ assert(!res);
+ assert(siginfo.si_pid == pid);
+
ptrace(PTRACE_CONT, pid, NULL, NULL);
+
wait(NULL);
}
return 0;
OpenPOWER on IntegriCloud