diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | platform-tracing.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index f5e137812..88c4633d5 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -405,6 +405,7 @@ AC_CHECK_HEADERS([ \ | |||
405 | sys/poll.h \ | 405 | sys/poll.h \ |
406 | sys/prctl.h \ | 406 | sys/prctl.h \ |
407 | sys/pstat.h \ | 407 | sys/pstat.h \ |
408 | sys/ptrace.h \ | ||
408 | sys/select.h \ | 409 | sys/select.h \ |
409 | sys/stat.h \ | 410 | sys/stat.h \ |
410 | sys/stream.h \ | 411 | sys/stream.h \ |
diff --git a/platform-tracing.c b/platform-tracing.c index 81020e7f7..4c80a282c 100644 --- a/platform-tracing.c +++ b/platform-tracing.c | |||
@@ -20,6 +20,9 @@ | |||
20 | #if defined(HAVE_SYS_PRCTL_H) | 20 | #if defined(HAVE_SYS_PRCTL_H) |
21 | #include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */ | 21 | #include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */ |
22 | #endif | 22 | #endif |
23 | #ifdef HAVE_SYS_PTRACE_H | ||
24 | #include <sys/ptrace.h> | ||
25 | #endif | ||
23 | #ifdef HAVE_PRIV_H | 26 | #ifdef HAVE_PRIV_H |
24 | #include <priv.h> /* For setpflags() and __PROC_PROTECT */ | 27 | #include <priv.h> /* For setpflags() and __PROC_PROTECT */ |
25 | #endif | 28 | #endif |
@@ -40,4 +43,9 @@ platform_disable_tracing(int strict) | |||
40 | if (setpflags(__PROC_PROTECT, 1) != 0 && strict) | 43 | if (setpflags(__PROC_PROTECT, 1) != 0 && strict) |
41 | fatal("unable to make the process untraceable"); | 44 | fatal("unable to make the process untraceable"); |
42 | #endif | 45 | #endif |
46 | #ifdef PT_DENY_ATTACH | ||
47 | /* Mac OS X */ | ||
48 | if (ptrace(PT_DENY_ATTACH, 0, 0, 0) == -1 && strict) | ||
49 | fatal("unable to set PT_DENY_ATTACH"); | ||
50 | #endif | ||
43 | } | 51 | } |