diff options
Diffstat (limited to 'platform.c')
-rw-r--r-- | platform.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 +} |