Received: from eggs.gnu.org ([2001:4830:134:3::10]:50615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPwOK-0003yp-7q for qemu-devel@nongnu.org; Fri, 05 Sep 2014 12:29:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPwOF-00033t-5B for qemu-devel@nongnu.org; Fri, 05 Sep 2014 12:29:40 -0400 Received: from rs04.intra2net.com ([85.214.66.2]:49588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPwOE-00033g-VZ for qemu-devel@nongnu.org; Fri, 05 Sep 2014 12:29:35 -0400 From: Philipp Gesang Date: Fri, 5 Sep 2014 18:29:31 +0200 Message-Id: <1409934571-15792-1-git-send-email-philipp.gesang@intra2net.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] seccomp: whitelist syscalls fallocate(), fadvise64(), inotify_init1() and inotify_add_watch() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Philipp Gesang , Eduardo Otubo fallocate() is needed for snapshotting. If it isn=E2=80=99t whitelisted $ qemu-img create -f qcow2 x.qcow 1G Formatting 'x.qcow', fmt=3Dqcow2 size=3D1073741824 encryption=3Doff c= luster_size=3D65536 lazy_refcounts=3Doff $ qemu-kvm -display none -monitor stdio -sandbox on x.qcow QEMU 2.1.50 monitor - type 'help' for more information (qemu) savevm foo (qemu) loadvm foo will fail, as will subsequent savevm commands on the same image. fadvise64(), inotify_init1(), inotify_add_watch() are needed by the SDL display. Without the whitelist entries, qemu-kvm -sandbox on fails immediately. In my tests fadvise64() is called 50--51 times per VM run. That number seems independent of the duration of the run. fallocate(), inotify_init1(), inotify_add_watch() are called once each. Accordingly, they are added to the whitelist at a very low priority. Signed-off-by: Philipp Gesang --- qemu-seccomp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qemu-seccomp.c b/qemu-seccomp.c index 0503764..af6a375 100644 --- a/qemu-seccomp.c +++ b/qemu-seccomp.c @@ -231,7 +231,11 @@ static const struct QemuSeccompSyscall seccomp_white= list[] =3D { { SCMP_SYS(shmctl), 240 }, { SCMP_SYS(mlock), 240 }, { SCMP_SYS(munlock), 240 }, - { SCMP_SYS(semctl), 240 } + { SCMP_SYS(semctl), 240 }, + { SCMP_SYS(fallocate), 240 }, + { SCMP_SYS(fadvise64), 240 }, + { SCMP_SYS(inotify_init1), 240 }, + { SCMP_SYS(inotify_add_watch), 240 } }; =20 int seccomp_start(void) --=20 1.9.3