Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/otubo/tags/pull-seccomp-2017091…
Browse files Browse the repository at this point in the history
…5' into staging

pull-seccomp-20170915

# gpg: Signature made Fri 15 Sep 2017 09:21:15 BST
# gpg:                using RSA key 0xDF32E7C0F0FFF9A2
# gpg: Good signature from "Eduardo Otubo (Senior Software Engineer) <otubo@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: D67E 1B50 9374 86B4 0723  DBAB DF32 E7C0 F0FF F9A2

* remotes/otubo/tags/pull-seccomp-20170915:
  buildsys: Move seccomp cflags/libs to per object
  seccomp: add resourcecontrol argument to command line
  seccomp: add spawn argument to command line
  seccomp: add elevateprivileges argument to command line
  seccomp: add obsolete argument to command line
  seccomp: changing from whitelist to blacklist

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Sep 15, 2017
2 parents 5faf2d3 + c3883e1 commit 11dd4b8
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 239 deletions.
2 changes: 2 additions & 0 deletions Makefile.objs
Expand Up @@ -70,6 +70,8 @@ common-obj-y += backends/
common-obj-y += chardev/

common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
qemu-seccomp.o-cflags := $(SECCOMP_CFLAGS)
qemu-seccomp.o-libs := $(SECCOMP_LIBS)

common-obj-$(CONFIG_FDT) += device_tree.o

Expand Down
6 changes: 4 additions & 2 deletions configure
Expand Up @@ -2035,8 +2035,8 @@ if test "$seccomp" != "no" ; then

if test "$libseccomp_minver" != "" &&
$pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
libs_softmmu="$libs_softmmu $($pkg_config --libs libseccomp)"
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libseccomp)"
seccomp_cflags="$($pkg_config --cflags libseccomp)"
seccomp_libs="$($pkg_config --libs libseccomp)"
seccomp="yes"
else
if test "$seccomp" = "yes" ; then
Expand Down Expand Up @@ -5829,6 +5829,8 @@ fi

if test "$seccomp" = "yes"; then
echo "CONFIG_SECCOMP=y" >> $config_host_mak
echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
fi

# XXX: suppress that
Expand Down
8 changes: 7 additions & 1 deletion include/sysemu/seccomp.h
Expand Up @@ -15,7 +15,13 @@
#ifndef QEMU_SECCOMP_H
#define QEMU_SECCOMP_H

#define QEMU_SECCOMP_SET_DEFAULT (1 << 0)
#define QEMU_SECCOMP_SET_OBSOLETE (1 << 1)
#define QEMU_SECCOMP_SET_PRIVILEGED (1 << 2)
#define QEMU_SECCOMP_SET_SPAWN (1 << 3)
#define QEMU_SECCOMP_SET_RESOURCECTL (1 << 4)

#include <seccomp.h>

int seccomp_start(void);
int seccomp_start(uint32_t seccomp_opts);
#endif
26 changes: 24 additions & 2 deletions qemu-options.hx
Expand Up @@ -4017,13 +4017,35 @@ Old param mode (ARM only).
ETEXI

DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \
"-sandbox <arg> Enable seccomp mode 2 system call filter (default 'off').\n",
"-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \
" [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \
" Enable seccomp mode 2 system call filter (default 'off').\n" \
" use 'obsolete' to allow obsolete system calls that are provided\n" \
" by the kernel, but typically no longer used by modern\n" \
" C library implementations.\n" \
" use 'elevateprivileges' to allow or deny QEMU process to elevate\n" \
" its privileges by blacklisting all set*uid|gid system calls.\n" \
" The value 'children' will deny set*uid|gid system calls for\n" \
" main QEMU process but will allow forks and execves to run unprivileged\n" \
" use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \
" blacklisting *fork and execve\n" \
" use 'resourcecontrol' to disable process affinity and schedular priority\n",
QEMU_ARCH_ALL)
STEXI
@item -sandbox @var{arg}
@item -sandbox @var{arg}[,obsolete=@var{string}][,elevateprivileges=@var{string}][,spawn=@var{string}][,resourcecontrol=@var{string}]
@findex -sandbox
Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will
disable it. The default is 'off'.
@table @option
@item obsolete=@var{string}
Enable Obsolete system calls
@item elevateprivileges=@var{string}
Disable set*uid|gid system calls
@item spawn=@var{string}
Disable *fork and execve
@item resourcecontrol=@var{string}
Disable process affinity and schedular priority
@end table
ETEXI

DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
Expand Down

0 comments on commit 11dd4b8

Please sign in to comment.