From 0fb7f5985351fbbcd2613d8485482c538e5123be Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 9 Jun 2016 16:23:07 +1000 Subject: Move prctl PR_SET_DUMPABLE into platform.c. This should make it easier to add additional platform support such as Solaris (bz#2584). --- platform.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'platform.c') 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 +#if defined(HAVE_SYS_PRCTL_H) +#include /* For prctl() and PR_SET_DUMPABLE */ +#endif #include #include @@ -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 +} -- cgit v1.2.1