Commit Graph

29 Commits

Author SHA1 Message Date
Damien Miller e83c989bfd use SC_ALLOW_ARG_MASK to limit mmap protections
Restrict to PROT_(READ|WRITE|NONE), i.e. exclude PROT_EXEC
2019-08-23 10:19:30 +10:00
Damien Miller f6906f9bf1 allow mprotect(2) with PROT_(READ|WRITE|NONE) only
Used by some hardened heap allocators. Requested by Yegor
Timoshenko in https://github.com/openssh/openssh-portable/pull/142
2019-08-23 10:10:03 +10:00
Harald Freudenberger b3a77b25e5 allow s390 specific ioctl for ecc hardware support
Adding another s390 specific ioctl to be able to support ECC hardware
acceleration to the sandbox seccomp filter rules.

Now the ibmca openssl engine provides elliptic curve cryptography
support with the help of libica and CCA crypto cards. This is done via
jet another ioctl call to the zcrypt device driver and so there is a
need to enable this on the openssl sandbox.

Code is s390 specific and has been tested, verified and reviewed.

Please note that I am also the originator of the previous changes in
that area.  I posted these changes to Eduardo and he forwarded the
patches to the openssl community.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Joerg Schmidbauer <jschmidb@de.ibm.com>
2019-06-05 15:08:46 +10:00
Damien Miller 149519b9f2 add futex(2) syscall to seccomp sandbox
Apparently needed for some glibc/openssl combinations.

Patch from Arkadiusz Miśkiewicz
2018-09-15 19:37:48 +10:00
Damien Miller 4ef75926ef Permit getuid()/geteuid() syscalls.
Requested for Linux/s390; patch from Eduardo Barretto via bz#2752;
ok dtucker
2018-05-25 13:45:01 +10:00
Darren Tucker 0e73428038 Allow nanosleep in preauth privsep child.
The new timing attack mitigation code uses nanosleep in the preauth
codepath, allow in sandbox.
2018-04-13 16:06:29 +10:00
Darren Tucker 17a54a03f5 Fix typo in "socketcall".
Pointed out by jjelen at redhat.com.
2017-04-25 08:32:27 +10:00
Darren Tucker 8b0eee148f Deny socketcall in seccomp filter on ppc64le.
OpenSSL is using socket() calls (in FIPS mode) when handling ECDSA keys
in privsep child. The socket() syscall is already denied in the seccomp
filter, but in ppc64le kernel, it is implemented using socketcall()
syscall, which is not denied yet (only SYS_SHUTDOWN is allowed) and
therefore fails hard.

Patch from jjelen at redhat.com.
2017-04-24 19:40:31 +10:00
Damien Miller 58b8cfa2a0 Missing header on Linux/s390
Patch from Jakub Jelen
2017-03-22 12:43:02 +11:00
Damien Miller 6b853c6f8b Fix syntax error on Linux/X32
Patch from Mike Frysinger
2017-03-21 08:47:55 +11:00
Damien Miller f86586b03f Make seccomp-bpf sandbox work on Linux/X32
Allow clock_gettime syscall with X32 bit masked off. Apparently
this is required for at least some kernel versions. bz#2142
Patch mostly by Colin Watson. ok dtucker@
2017-03-14 18:26:29 +11:00
Damien Miller e3ea335abe Remove macro trickery; no binary change
This stops the SC_ALLOW(), SC_ALLOW_ARG() and SC_DENY() macros
prepending __NR_ to the syscall number parameter and just makes
them explicit in the macro invocations.

No binary change in stripped object file before/after.
2017-03-14 17:53:17 +11:00
Damien Miller 5f1596e11d support ioctls for ICA crypto card on Linux/s390
Based on patch from Eduardo Barretto; ok dtucker@
2017-03-14 17:53:17 +11:00
Damien Miller 9e96b41682 Fix weakness in seccomp-bpf sandbox arg inspection
Syscall arguments are passed via an array of 64-bit values in struct
seccomp_data, but we were only inspecting the bottom 32 bits and not
even those correctly for BE systems.

Fortunately, the only case argument inspection was used was in the
socketcall filtering so using this for sandbox escape seems
impossible.

ok dtucker
2017-03-14 12:41:53 +11:00
Damien Miller f64062b1f7 Deny lstat syscalls in seccomp sandbox
Avoids sandbox violations for some krb/gssapi libraries.
2016-05-20 09:56:53 +10:00
Damien Miller 26ad182472 allow getrandom syscall; from Felix von Leitner 2015-09-10 10:57:41 +10:00
djm@openbsd.org 512caddf59 upstream commit
add getpid to sandbox, reachable by grace_alarm_handler

reported by Jakub Jelen; bz#2419

Upstream-ID: d0da1117c16d4c223954995d35b0f47c8f684cd8
2015-06-30 08:36:34 +10:00
Damien Miller bc20205c91 add missing pselect6
patch from Jakub Jelen
2015-06-25 09:51:39 +10:00
Damien Miller 97e2e1596c trivial optimisation for seccomp-bpf
When doing arg inspection and the syscall doesn't match, skip
past the instruction that reloads the syscall into the accumulator,
since the accumulator hasn't been modified at this point.
2015-06-17 14:36:54 +10:00
Damien Miller 99f33d7304 aarch64 support for seccomp-bpf sandbox
Also resort and tidy syscall list. Based on patches by Jakub Jelen
bz#2361; ok dtucker@
2015-06-17 10:50:51 +10:00
Damien Miller 0fa0ed061b - (djm) [sandbox-seccomp-filter.c] Allow mremap and exit for DietLibc;
patch from Felix von Leitner; ok dtucker
2014-09-10 08:15:34 +10:00
Damien Miller 48abc47e60 - (djm) [sandbox-seccomp-filter.c] Soft-fail stat() syscalls. Add XXX to
remind myself to add sandbox violation logging via the log socket.
2014-03-17 14:45:56 +11:00
Damien Miller 6434cb2cfb - (djm) [sandbox-seccomp-filter.c] Not all Linux architectures define
__NR_shutdown; some go via the socketcall(2) multiplexer.
2014-02-06 11:17:50 +11:00
Damien Miller 7e5cec6070 - (djm) [sandbox-seccomp-filter.c sandbox-systrace.c] Allow shutdown(2)
syscall from sandboxes; it may be called by packet_close.
2014-01-31 09:25:34 +11:00
Damien Miller 868ea1ea1c - (djm) [Makefile.in configure.ac sandbox-capsicum.c sandbox-darwin.c]
[sandbox-null.c sandbox-rlimit.c sandbox-seccomp-filter.c]
   [sandbox-systrace.c ssh-sandbox.h sshd.c] Support preauth sandboxing
   using the Capsicum API introduced in FreeBSD 10. Patch by Dag-Erling
   Smorgrav, updated by Loganaden Velvindron @ AfriNIC; ok dtucker@
2014-01-17 16:47:04 +11:00
Darren Tucker e9887d1c37 - (dtucker) [sandbox-seccomp-filter.c] Allow clock_gettimeofday. 2013-06-02 09:17:09 +10:00
Damien Miller 91f40d8592 - (djm) [configure.ac sandbox-seccomp-filter.c] Support for Linux
seccomp-bpf sandbox on ARM. Patch from shawnlandden AT gmail.com;
       ok dtucker
2013-02-22 11:37:00 +11:00
Damien Miller a0433a7096 - (djm) [sandbox-seccomp-filter.c] fallback to rlimit if seccomp filter is
not available. Allows use of sshd compiled on host with a filter-capable
   kernel on hosts that lack the support. bz#2011 ok dtucker@
2012-07-06 10:27:10 +10:00
Damien Miller e0956e3834 - (djm) [Makefile.in configure.ac sandbox-seccomp-filter.c] Add sandbox
mode for Linux's new seccomp filter; patch from Will Drewry; feedback
   and ok dtucker@
2012-04-04 11:27:54 +10:00