summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2016-10-31 22:12:33 +0100
committerDarren Tucker <dtucker@zip.com.au>2016-10-31 22:12:33 +0100
commit5ee3fb5affd7646f141749483205ade5fc54adaf (patch)
treef66f754606f1335a2197bfa83b6986be9539e4f6
parentUnbreak AES-CTR ciphers on old (~0.9.8) OpenSSL (diff)
downloadopenssh-5ee3fb5affd7646f141749483205ade5fc54adaf.tar.xz
openssh-5ee3fb5affd7646f141749483205ade5fc54adaf.zip
Use ptrace(PT_DENY_ATTACH, ..) on OS X.
-rw-r--r--configure.ac1
-rw-r--r--platform-tracing.c8
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([ \
sys/poll.h \
sys/prctl.h \
sys/pstat.h \
+ sys/ptrace.h \
sys/select.h \
sys/stat.h \
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 @@
#if defined(HAVE_SYS_PRCTL_H)
#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
#endif
+#ifdef HAVE_SYS_PTRACE_H
+#include <sys/ptrace.h>
+#endif
#ifdef HAVE_PRIV_H
#include <priv.h> /* For setpflags() and __PROC_PROTECT */
#endif
@@ -40,4 +43,9 @@ platform_disable_tracing(int strict)
if (setpflags(__PROC_PROTECT, 1) != 0 && strict)
fatal("unable to make the process untraceable");
#endif
+#ifdef PT_DENY_ATTACH
+ /* Mac OS X */
+ if (ptrace(PT_DENY_ATTACH, 0, 0, 0) == -1 && strict)
+ fatal("unable to set PT_DENY_ATTACH");
+#endif
}