diff options
author | Darren Tucker <dtucker@zip.com.au> | 2016-06-09 08:23:07 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2016-06-09 08:23:07 +0200 |
commit | 0fb7f5985351fbbcd2613d8485482c538e5123be (patch) | |
tree | e1f112e1d19fcb004a643bef8ce24c03ea38e5e2 /platform.c | |
parent | upstream commit (diff) | |
download | openssh-0fb7f5985351fbbcd2613d8485482c538e5123be.tar.xz openssh-0fb7f5985351fbbcd2613d8485482c538e5123be.zip |
Move prctl PR_SET_DUMPABLE into platform.c.
This should make it easier to add additional platform support such as
Solaris (bz#2584).
Diffstat (limited to 'platform.c')
-rw-r--r-- | platform.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform.c b/platform.c index 1f68df3a6..ee3e06914 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 +} |