From 5ee3fb5affd7646f141749483205ade5fc54adaf Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 1 Nov 2016 08:12:33 +1100 Subject: Use ptrace(PT_DENY_ATTACH, ..) on OS X. --- platform-tracing.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'platform-tracing.c') 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 /* For prctl() and PR_SET_DUMPABLE */ #endif +#ifdef HAVE_SYS_PTRACE_H +#include +#endif #ifdef HAVE_PRIV_H #include /* 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 } -- cgit v1.2.3