summaryrefslogtreecommitdiff
path: root/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'platform.c')
-rw-r--r--platform.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform.c b/platform.c
index 1f68df3a..ee3e0691 100644
--- a/platform.c
+++ b/platform.c
@@ -19,6 +19,9 @@
#include "includes.h"
#include <sys/types.h>
+#if defined(HAVE_SYS_PRCTL_H)
+#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
+#endif
#include <stdarg.h>
#include <unistd.h>
@@ -217,3 +220,14 @@ platform_sys_dir_uid(uid_t uid)
#endif
return 0;
}
+
+void
+platform_disable_tracing(int strict)
+{
+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
+ /* Disable ptrace on Linux without sgid bit */
+ if (prctl(PR_SET_DUMPABLE, 0) != 0)
+ if (strict)
+ fatal("unable to make the process undumpable");
+#endif
+}