From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqDry-0002GN-Gg for qemu-devel@nongnu.org; Mon, 09 Dec 2013 22:20:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqDrp-0000Rx-I0 for qemu-devel@nongnu.org; Mon, 09 Dec 2013 22:20:22 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:58132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqDrp-0000Rr-BS for qemu-devel@nongnu.org; Mon, 09 Dec 2013 22:20:13 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Dec 2013 20:20:11 -0700 Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id D2EF76E8041 for ; Mon, 9 Dec 2013 22:20:05 -0500 (EST) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22035.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBA3K8Kq4063544 for ; Tue, 10 Dec 2013 03:20:08 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBA3K85X012551 for ; Mon, 9 Dec 2013 22:20:08 -0500 Message-ID: <52A68867.4080309@linux.vnet.ibm.com> Date: Mon, 09 Dec 2013 22:20:07 -0500 From: Corey Bryant MIME-Version: 1.0 References: <1386609652-7876-1-git-send-email-otubo@linux.vnet.ibm.com> <20131209173330.GG22114@redhat.com> <52A60328.6020102@linux.vnet.ibm.com> In-Reply-To: <52A60328.6020102@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] seccomp: "-sandbox on" won't kill Qemu when option not built in List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Otubo , "Daniel P. Berrange" Cc: pmoore@redhat.com, lmr@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws On 12/09/2013 12:51 PM, Eduardo Otubo wrote: > > > On 12/09/2013 03:33 PM, Daniel P. Berrange wrote: >> On Mon, Dec 09, 2013 at 03:20:52PM -0200, Eduardo Otubo wrote: >>> This option was requested by virt-test team so they can run tests with >>> Qemu and "-sandbox on" set without breaking whole test if host doesn't >>> have support for seccomp in kernel. It covers two possibilities: >>> >>> 1) Host kernel support does not support seccomp, but user installed >>> Qemu >>> package with sandbox support: Libseccomp will fail -> qemu will >>> fail >>> nicely and won't stop execution. >>> >>> 2) Host kernel has support but Qemu package wasn't built with sandbox >>> feature. Qemu will fail nicely and won't stop execution. >>> >>> Signed-off-by: Eduardo Otubo >>> --- >>> vl.c | 10 +++------- >>> 1 file changed, 3 insertions(+), 7 deletions(-) >>> >>> diff --git a/vl.c b/vl.c >>> index b0399de..a0806dc 100644 >>> --- a/vl.c >>> +++ b/vl.c >>> @@ -967,13 +967,11 @@ static int parse_sandbox(QemuOpts *opts, void >>> *opaque) >>> #ifdef CONFIG_SECCOMP >>> if (seccomp_start() < 0) { >>> qerror_report(ERROR_CLASS_GENERIC_ERROR, >>> - "failed to install seccomp syscall filter >>> in the kernel"); >>> - return -1; >>> + "failed to install seccomp syscall filter >>> in the kernel, disabling it"); >>> } >>> #else >>> qerror_report(ERROR_CLASS_GENERIC_ERROR, >>> - "sandboxing request but seccomp is not >>> compiled into this build"); >>> - return -1; >>> + "sandboxing request but seccomp is not >>> compiled into this build, disabling it"); >>> #endif >>> } >>> >>> @@ -3808,9 +3806,7 @@ int main(int argc, char **argv, char **envp) >>> exit(1); >>> } >>> >>> - if (qemu_opts_foreach(qemu_find_opts("sandbox"), parse_sandbox, >>> NULL, 0)) { >>> - exit(1); >>> - } >>> + qemu_opts_foreach(qemu_find_opts("sandbox"), parse_sandbox, >>> NULL, 0); >>> >>> #ifndef _WIN32 >>> if (qemu_opts_foreach(qemu_find_opts("add-fd"), parse_add_fd, >>> NULL, 1)) { >> >> This change is really dubious from a security POV. If the admin requested >> sandboxing and the host or QEMU build cannot support it, then QEMU really >> *must* exit. > > I think an admin must know what he's doing. If he requested sandbox but > without kernel support he need to step back a little and understand what > he's doing. This patch won't decrease the security level, IMHO. > Preventing qemu from exiting is definitely not the right approach. Please feel free to run code by me ahead of time in the future. >> >> IMHO the test suite should probe to see if sandbox is working or not, and >> just not use the "-sandbox on" arg if the host doesn't support it. > > But I think this could be done on virt-test as well :) > This would make sense. Although it sounds like Lucas was looking for an error message when seccomp kills qemu. Maybe virt-test could grep the audit log for the existence of a "type=SECCOMP" record within the test's time of execution, and issue a message based on that. -- Regards, Corey Bryant