qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: Eduardo Otubo <otubo@linux.vnet.ibm.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Cc: pmoore@redhat.com, lmr@redhat.com, qemu-devel@nongnu.org,
	anthony@codemonkey.ws
Subject: Re: [Qemu-devel] [PATCH] seccomp: "-sandbox on" won't kill Qemu when option not built in
Date: Mon, 09 Dec 2013 22:20:07 -0500	[thread overview]
Message-ID: <52A68867.4080309@linux.vnet.ibm.com> (raw)
In-Reply-To: <52A60328.6020102@linux.vnet.ibm.com>



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 <otubo@linux.vnet.ibm.com>
>>> ---
>>>   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

  parent reply	other threads:[~2013-12-10  3:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09 17:20 [Qemu-devel] [PATCH] seccomp: "-sandbox on" won't kill Qemu when option not built in Eduardo Otubo
2013-12-09 17:33 ` Daniel P. Berrange
2013-12-09 17:51   ` Eduardo Otubo
2013-12-09 18:16     ` Paul Moore
2013-12-10  3:20     ` Corey Bryant [this message]
2013-12-10 18:48       ` Lucas Meneghel Rodrigues
2013-12-10 19:31         ` Paul Moore
2013-12-10 20:13           ` Lucas Meneghel Rodrigues
2013-12-10 19:35         ` Eduardo Otubo
2013-12-09 19:11 ` Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A68867.4080309@linux.vnet.ibm.com \
    --to=coreyb@linux.vnet.ibm.com \
    --cc=anthony@codemonkey.ws \
    --cc=berrange@redhat.com \
    --cc=lmr@redhat.com \
    --cc=otubo@linux.vnet.ibm.com \
    --cc=pmoore@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).