From patchwork Mon Nov 2 22:53:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 55919 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp1527487lbr; Mon, 2 Nov 2015 14:54:03 -0800 (PST) X-Received: by 10.55.81.11 with SMTP id f11mr18178672qkb.10.1446504843201; Mon, 02 Nov 2015 14:54:03 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 77si20175889qhh.73.2015.11.02.14.54.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Nov 2015 14:54:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:44629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtNzG-0000JD-SI for patch@linaro.org; Mon, 02 Nov 2015 17:54:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtNyp-0008SC-JZ for qemu-devel@nongnu.org; Mon, 02 Nov 2015 17:53:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtNym-0005dc-Dj for qemu-devel@nongnu.org; Mon, 02 Nov 2015 17:53:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtNym-0005dW-8E for qemu-devel@nongnu.org; Mon, 02 Nov 2015 17:53:32 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 068B98F50E; Mon, 2 Nov 2015 22:53:31 +0000 (UTC) Received: from apm-mustang-ev3-03.lab.eng.brq.redhat.com (apm-mustang-ev3-03.lab.eng.brq.redhat.com [10.34.42.82]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA2MrSDi024308; Mon, 2 Nov 2015 17:53:29 -0500 From: Andrew Jones To: qemu-devel@nongnu.org Date: Mon, 2 Nov 2015 23:53:26 +0100 Message-Id: <1446504806-7316-1-git-send-email-drjones@redhat.com> In-Reply-To: <1446212690-7656-2-git-send-email-eduardo.otubo@profitbricks.com> References: <1446212690-7656-2-git-send-email-eduardo.otubo@profitbricks.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, eduardo.otubo@profitbricks.com Subject: [Qemu-devel] [PATCH v3] seccomp: add cacheflush to whitelist X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org cacheflush is an arm-specific syscall that qemu built for arm uses. Add it to the whitelist, but only if we're linking with a recent enough libseccomp. Signed-off-by: Andrew Jones --- v3: deal with major and minor version number bumps v2: only add cacheflush if libseccomp supports it qemu-seccomp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 1.8.3.1 diff --git a/qemu-seccomp.c b/qemu-seccomp.c index 80d034a8d5190..c831fe83ad500 100644 --- a/qemu-seccomp.c +++ b/qemu-seccomp.c @@ -16,6 +16,14 @@ #include #include "sysemu/seccomp.h" +#if SCMP_VER_MAJOR >= 3 + #define HAVE_CACHEFLUSH +#elif SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR >= 3 + #define HAVE_CACHEFLUSH +#elif SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR == 2 && SCMP_VER_MICRO >= 3 + #define HAVE_CACHEFLUSH +#endif + struct QemuSeccompSyscall { int32_t num; uint8_t priority; @@ -238,7 +246,10 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { { SCMP_SYS(inotify_init1), 240 }, { SCMP_SYS(inotify_add_watch), 240 }, { SCMP_SYS(mbind), 240 }, - { SCMP_SYS(memfd_create), 240 } + { SCMP_SYS(memfd_create), 240 }, +#ifdef HAVE_CACHEFLUSH + { SCMP_SYS(cacheflush), 240 }, +#endif }; int seccomp_start(void)