summaryrefslogtreecommitdiff
path: root/platform.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2016-06-09 16:23:07 +1000
committerDarren Tucker <dtucker@zip.com.au>2016-06-09 16:23:07 +1000
commit0fb7f5985351fbbcd2613d8485482c538e5123be (patch)
treee1f112e1d19fcb004a643bef8ce24c03ea38e5e2 /platform.c
parente6508898c3cd838324ecfe1abd0eb8cf802e7106 (diff)
downloadopenssh-git-0fb7f5985351fbbcd2613d8485482c538e5123be.tar.gz
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.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
+}