From c61b42f2678f21f05653ac2d3d241b48ab5d59ac Mon Sep 17 00:00:00 2001 From: "deraadt@openbsd.org" Date: Fri, 2 Oct 2015 01:39:26 +0000 Subject: upstream commit re-order system calls in order of risk, ok i'll be honest, ordered this way they look like tame... ok djm Upstream-ID: 42a1e6d251fd8be13c8262bee026059ae6328813 --- sandbox-systrace.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'sandbox-systrace.c') diff --git a/sandbox-systrace.c b/sandbox-systrace.c index 3830ed16c..8ebdb73df 100644 --- a/sandbox-systrace.c +++ b/sandbox-systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sandbox-systrace.c,v 1.17 2015/07/27 16:29:23 guenther Exp $ */ +/* $OpenBSD: sandbox-systrace.c,v 1.18 2015/10/02 01:39:26 deraadt Exp $ */ /* * Copyright (c) 2011 Damien Miller * @@ -15,10 +15,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "includes.h" - -#ifdef SANDBOX_SYSTRACE - #include #include #include @@ -50,9 +46,17 @@ struct sandbox_policy { /* Permitted syscalls in preauth. Unlisted syscalls get SYSTR_POLICY_KILL */ static const struct sandbox_policy preauth_policy[] = { - { SYS_clock_gettime, SYSTR_POLICY_PERMIT }, - { SYS_close, SYSTR_POLICY_PERMIT }, { SYS_exit, SYSTR_POLICY_PERMIT }, +#ifdef SYS_kbind + { SYS_kbind, SYSTR_POLICY_PERMIT }, +#endif + + { SYS_getpid, SYSTR_POLICY_PERMIT }, + { SYS_getpgid, SYSTR_POLICY_PERMIT }, + { SYS_clock_gettime, SYSTR_POLICY_PERMIT }, + { SYS_gettimeofday, SYSTR_POLICY_PERMIT }, + { SYS_sigprocmask, SYSTR_POLICY_PERMIT }, + #ifdef SYS_getentropy /* OpenBSD 5.6 and newer use getentropy(2) to seed arc4random(3). */ { SYS_getentropy, SYSTR_POLICY_PERMIT }, @@ -60,27 +64,23 @@ static const struct sandbox_policy preauth_policy[] = { /* Previous releases used sysctl(3)'s kern.arnd variable. */ { SYS___sysctl, SYSTR_POLICY_PERMIT }, #endif - { SYS_getpid, SYSTR_POLICY_PERMIT }, - { SYS_getpgid, SYSTR_POLICY_PERMIT }, - { SYS_gettimeofday, SYSTR_POLICY_PERMIT }, -#ifdef SYS_kbind - { SYS_kbind, SYSTR_POLICY_PERMIT }, -#endif + { SYS_sendsyslog, SYSTR_POLICY_PERMIT }, + { SYS_madvise, SYSTR_POLICY_PERMIT }, { SYS_mmap, SYSTR_POLICY_PERMIT }, { SYS_mprotect, SYSTR_POLICY_PERMIT }, { SYS_mquery, SYSTR_POLICY_PERMIT }, { SYS_munmap, SYSTR_POLICY_PERMIT }, - { SYS_open, SYSTR_POLICY_NEVER }, + { SYS_poll, SYSTR_POLICY_PERMIT }, - { SYS_read, SYSTR_POLICY_PERMIT }, { SYS_select, SYSTR_POLICY_PERMIT }, -#ifdef SYS_sendsyslog - { SYS_sendsyslog, SYSTR_POLICY_PERMIT }, -#endif - { SYS_shutdown, SYSTR_POLICY_PERMIT }, - { SYS_sigprocmask, SYSTR_POLICY_PERMIT }, + { SYS_read, SYSTR_POLICY_PERMIT }, { SYS_write, SYSTR_POLICY_PERMIT }, + { SYS_shutdown, SYSTR_POLICY_PERMIT }, + { SYS_close, SYSTR_POLICY_PERMIT }, + + { SYS_open, SYSTR_POLICY_NEVER }, + { -1, -1 } }; @@ -91,7 +91,7 @@ struct ssh_sandbox { }; struct ssh_sandbox * -ssh_sandbox_init(struct monitor *monitor) +ssh_sandbox_init(void) { struct ssh_sandbox *box; @@ -208,5 +208,3 @@ ssh_sandbox_parent_preauth(struct ssh_sandbox *box, pid_t child_pid) { ssh_sandbox_parent(box, child_pid, preauth_policy); } - -#endif /* SANDBOX_SYSTRACE */ -- cgit v1.2.3 From 0dc74512bdb105b048883f07de538b37e5e024d4 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 5 Oct 2015 18:33:05 -0700 Subject: unbreak merge botch --- sandbox-systrace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sandbox-systrace.c') diff --git a/sandbox-systrace.c b/sandbox-systrace.c index 8ebdb73df..46c36a767 100644 --- a/sandbox-systrace.c +++ b/sandbox-systrace.c @@ -15,6 +15,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "includes.h" + +#ifdef SANDBOX_SYSTRACE + #include #include #include @@ -91,7 +95,7 @@ struct ssh_sandbox { }; struct ssh_sandbox * -ssh_sandbox_init(void) +ssh_sandbox_init(struct monitor *monitor) { struct ssh_sandbox *box; @@ -208,3 +212,5 @@ ssh_sandbox_parent_preauth(struct ssh_sandbox *box, pid_t child_pid) { ssh_sandbox_parent(box, child_pid, preauth_policy); } + +#endif /* SANDBOX_SYSTRACE */ -- cgit v1.2.3 From 996b24cebf20077fbe5db07b3a2c20c2d9db736e Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 29 Oct 2015 20:57:34 +1100 Subject: (re)wrap SYS_sendsyslog in ifdef. Replace ifdef that went missing in commit c61b42f2678f21f05653ac2d3d241b48ab5d59ac. Fixes build on older OpenBSDs. --- sandbox-systrace.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sandbox-systrace.c') diff --git a/sandbox-systrace.c b/sandbox-systrace.c index 46c36a767..b4d8d04ca 100644 --- a/sandbox-systrace.c +++ b/sandbox-systrace.c @@ -68,7 +68,9 @@ static const struct sandbox_policy preauth_policy[] = { /* Previous releases used sysctl(3)'s kern.arnd variable. */ { SYS___sysctl, SYSTR_POLICY_PERMIT }, #endif +#ifdef SYS_sendsyslog { SYS_sendsyslog, SYSTR_POLICY_PERMIT }, +#endif { SYS_madvise, SYSTR_POLICY_PERMIT }, { SYS_mmap, SYSTR_POLICY_PERMIT }, -- cgit v1.2.3