Received: from eggs.gnu.org ([2001:4830:134:3::10]:40224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnpqd-0001vm-Ob for qemu-devel@nongnu.org; Mon, 10 Nov 2014 09:21:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnpqW-0004kp-Q8 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 09:21:39 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:56436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnpqW-0004jq-Kd for qemu-devel@nongnu.org; Mon, 10 Nov 2014 09:21:32 -0500 Received: by mail-wi0-f172.google.com with SMTP id bs8so10795838wib.17 for ; Mon, 10 Nov 2014 06:21:25 -0800 (PST) From: Eduardo Otubo Date: Mon, 10 Nov 2014 15:21:17 +0100 Message-Id: <1415629278-24675-2-git-send-email-eduardo.otubo@profitbricks.com> In-Reply-To: <1415629278-24675-1-git-send-email-eduardo.otubo@profitbricks.com> References: <1415629278-24675-1-git-send-email-eduardo.otubo@profitbricks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 1/2] 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: pmoore@redhat.com, peter.maydell@linaro.org, philipp.gesang@intra2net.com From: Philipp Gesang fallocate() is needed for snapshotting. If it isn’t whitelisted $ qemu-img create -f qcow2 x.qcow 1G Formatting 'x.qcow', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off $ 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_whitelist[] = { { 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 } }; int seccomp_start(void) -- 1.9.1