* [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
@ 2015-10-01 4:36 Namsun Ch'o
2015-10-01 12:06 ` Markus Armbruster
2015-10-08 13:34 ` Eduardo Otubo
0 siblings, 2 replies; 12+ messages in thread
From: Namsun Ch'o @ 2015-10-01 4:36 UTC (permalink / raw)
To: qemu-devel; +Cc: eduardo.otubo
The seccomp sandbox doesn't whitelist setuid, setgid, or setgroups, which are
needed for -runas to work. It also doesn't whitelist chroot, which is needed
for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
privileges or chroots, so without these whitelisted, -runas and -chroot cause
QEMU to be killed with -sandbox on. This patch adds those syscalls.
Signed-off-by: Namsun Ch'o <namnamc@safe-mail.net>
---
diff --git a/qemu-seccomp.c b/qemu-seccomp.c
index f9de0d3..5cb1809 100644
--- a/qemu-seccomp.c
+++ b/qemu-seccomp.c
@@ -237,7 +237,11 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = {
{ SCMP_SYS(fadvise64), 240 },
{ SCMP_SYS(inotify_init1), 240 },
{ SCMP_SYS(inotify_add_watch), 240 },
- { SCMP_SYS(mbind), 240 }
+ { SCMP_SYS(mbind), 240 },
+ { SCMP_SYS(setuid), 240 },
+ { SCMP_SYS(setgid), 240 },
+ { SCMP_SYS(chroot), 240 },
+ { SCMP_SYS(setgroups), 240 }
};
int seccomp_start(void)
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-01 4:36 [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox Namsun Ch'o
@ 2015-10-01 12:06 ` Markus Armbruster
2015-10-02 8:30 ` Daniel P. Berrange
2015-10-08 13:34 ` Eduardo Otubo
1 sibling, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-10-01 12:06 UTC (permalink / raw)
To: Namsun Ch'o; +Cc: qemu-devel, eduardo.otubo
"Namsun Ch'o" <namnamc@Safe-mail.net> writes:
> The seccomp sandbox doesn't whitelist setuid, setgid, or setgroups, which are
> needed for -runas to work. It also doesn't whitelist chroot, which is needed
> for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
> privileges or chroots, so without these whitelisted, -runas and -chroot cause
> QEMU to be killed with -sandbox on. This patch adds those syscalls.
Should it enable seccomp a bit later?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-01 12:06 ` Markus Armbruster
@ 2015-10-02 8:30 ` Daniel P. Berrange
2015-10-02 10:05 ` Markus Armbruster
0 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrange @ 2015-10-02 8:30 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Namsun Ch'o, qemu-devel, eduardo.otubo
On Thu, Oct 01, 2015 at 02:06:32PM +0200, Markus Armbruster wrote:
> "Namsun Ch'o" <namnamc@Safe-mail.net> writes:
>
> > The seccomp sandbox doesn't whitelist setuid, setgid, or setgroups, which are
> > needed for -runas to work. It also doesn't whitelist chroot, which is needed
> > for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
> > privileges or chroots, so without these whitelisted, -runas and -chroot cause
> > QEMU to be killed with -sandbox on. This patch adds those syscalls.
>
> Should it enable seccomp a bit later?
Yeah, I think it would be better to move the seccomp enablement later.
Adding setuid and chroot to the allow list is pretty strongly undesirable
from a security protection POV.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-02 8:30 ` Daniel P. Berrange
@ 2015-10-02 10:05 ` Markus Armbruster
2015-10-02 14:08 ` Eduardo Otubo
0 siblings, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-10-02 10:05 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: Namsun Ch'o, qemu-devel, eduardo.otubo
"Daniel P. Berrange" <berrange@redhat.com> writes:
> On Thu, Oct 01, 2015 at 02:06:32PM +0200, Markus Armbruster wrote:
>> "Namsun Ch'o" <namnamc@Safe-mail.net> writes:
>>
>> > The seccomp sandbox doesn't whitelist setuid, setgid, or
>> > setgroups, which are
>> > needed for -runas to work. It also doesn't whitelist chroot, which is needed
>> > for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
>> > privileges or chroots, so without these whitelisted, -runas and
>> > -chroot cause
>> > QEMU to be killed with -sandbox on. This patch adds those syscalls.
>>
>> Should it enable seccomp a bit later?
>
> Yeah, I think it would be better to move the seccomp enablement later.
Let's do that then.
> Adding setuid and chroot to the allow list is pretty strongly undesirable
> from a security protection POV.
Indeed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-02 10:05 ` Markus Armbruster
@ 2015-10-02 14:08 ` Eduardo Otubo
2015-10-02 14:15 ` Daniel P. Berrange
0 siblings, 1 reply; 12+ messages in thread
From: Eduardo Otubo @ 2015-10-02 14:08 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Namsun Ch'o, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]
On Fri, Oct 02, 2015 at 12=05=58PM +0200, Markus Armbruster wrote:
> "Daniel P. Berrange" <berrange@redhat.com> writes:
>
> > On Thu, Oct 01, 2015 at 02:06:32PM +0200, Markus Armbruster wrote:
> >> "Namsun Ch'o" <namnamc@Safe-mail.net> writes:
> >>
> >> > The seccomp sandbox doesn't whitelist setuid, setgid, or
> >> > setgroups, which are
> >> > needed for -runas to work. It also doesn't whitelist chroot, which is needed
> >> > for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
> >> > privileges or chroots, so without these whitelisted, -runas and
> >> > -chroot cause
> >> > QEMU to be killed with -sandbox on. This patch adds those syscalls.
> >>
> >> Should it enable seccomp a bit later?
> >
> > Yeah, I think it would be better to move the seccomp enablement later.
>
> Let's do that then.
Where exactly you guys think we could call seccomp enablement? Right
it's called (almost) right before cpu_exec_init_all(), on vl.c:4013. I
guess it is as later as it could.
>
> > Adding setuid and chroot to the allow list is pretty strongly undesirable
> > from a security protection POV.
>
> Indeed.
--
Eduardo Otubo
ProfitBricks GmbH
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-02 14:08 ` Eduardo Otubo
@ 2015-10-02 14:15 ` Daniel P. Berrange
2015-10-02 15:36 ` Eduardo Otubo
0 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrange @ 2015-10-02 14:15 UTC (permalink / raw)
To: Markus Armbruster, Namsun Ch'o, qemu-devel
On Fri, Oct 02, 2015 at 04:08:20PM +0200, Eduardo Otubo wrote:
> On Fri, Oct 02, 2015 at 12=05=58PM +0200, Markus Armbruster wrote:
> > "Daniel P. Berrange" <berrange@redhat.com> writes:
> >
> > > On Thu, Oct 01, 2015 at 02:06:32PM +0200, Markus Armbruster wrote:
> > >> "Namsun Ch'o" <namnamc@Safe-mail.net> writes:
> > >>
> > >> > The seccomp sandbox doesn't whitelist setuid, setgid, or
> > >> > setgroups, which are
> > >> > needed for -runas to work. It also doesn't whitelist chroot, which is needed
> > >> > for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
> > >> > privileges or chroots, so without these whitelisted, -runas and
> > >> > -chroot cause
> > >> > QEMU to be killed with -sandbox on. This patch adds those syscalls.
> > >>
> > >> Should it enable seccomp a bit later?
> > >
> > > Yeah, I think it would be better to move the seccomp enablement later.
> >
> > Let's do that then.
>
> Where exactly you guys think we could call seccomp enablement? Right
> it's called (almost) right before cpu_exec_init_all(), on vl.c:4013. I
> guess it is as later as it could.
It depends on what you consider seccomp to be protecting against. I think
its primary goal is to protect against exploit after a guest OS breakout,
in which case it does not need to be enabled until the guest CPUs start
executing, which IIUC, means immediately before main_loop().
If we intend seccomp to protect against flaws during QEMU setup, then having
it earlier is neccessary. eg QEMU opening a corrupt qcow2 image which might
exploit QEMU before the guest CPUs start.
If the latter is the case, then we could start with a relaxed seccomp
sandbox which included the setuid/chroot features, and then switch to a
more restricted one which blocked them before main_loop() runs.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-02 14:15 ` Daniel P. Berrange
@ 2015-10-02 15:36 ` Eduardo Otubo
0 siblings, 0 replies; 12+ messages in thread
From: Eduardo Otubo @ 2015-10-02 15:36 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: Namsun Ch'o, Markus Armbruster, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]
On Fri, Oct 02, 2015 at 03=15=05PM +0100, Daniel P. Berrange wrote:
> On Fri, Oct 02, 2015 at 04:08:20PM +0200, Eduardo Otubo wrote:
> > On Fri, Oct 02, 2015 at 12=05=58PM +0200, Markus Armbruster wrote:
> > > "Daniel P. Berrange" <berrange@redhat.com> writes:
> > >
> > > > On Thu, Oct 01, 2015 at 02:06:32PM +0200, Markus Armbruster wrote:
> > > >> "Namsun Ch'o" <namnamc@Safe-mail.net> writes:
> > > >>
> > > >> > The seccomp sandbox doesn't whitelist setuid, setgid, or
> > > >> > setgroups, which are
> > > >> > needed for -runas to work. It also doesn't whitelist chroot, which is needed
> > > >> > for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
> > > >> > privileges or chroots, so without these whitelisted, -runas and
> > > >> > -chroot cause
> > > >> > QEMU to be killed with -sandbox on. This patch adds those syscalls.
> > > >>
> > > >> Should it enable seccomp a bit later?
> > > >
> > > > Yeah, I think it would be better to move the seccomp enablement later.
> > >
> > > Let's do that then.
> >
> > Where exactly you guys think we could call seccomp enablement? Right
> > it's called (almost) right before cpu_exec_init_all(), on vl.c:4013. I
> > guess it is as later as it could.
>
> It depends on what you consider seccomp to be protecting against. I think
> its primary goal is to protect against exploit after a guest OS breakout,
> in which case it does not need to be enabled until the guest CPUs start
> executing, which IIUC, means immediately before main_loop().
>
> If we intend seccomp to protect against flaws during QEMU setup, then having
> it earlier is neccessary. eg QEMU opening a corrupt qcow2 image which might
> exploit QEMU before the guest CPUs start.
>
> If the latter is the case, then we could start with a relaxed seccomp
> sandbox which included the setuid/chroot features, and then switch to a
> more restricted one which blocked them before main_loop() runs.
Our intention since the beginning was to protect the host from the
illegal guest operations. But you do have an interesting point about
flaws on qemu itself. Perhaps this might be something I could work on to
improve (start a bigger whitelist and get it tighter before guest
launches).
--
Eduardo Otubo
ProfitBricks GmbH
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-01 4:36 [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox Namsun Ch'o
2015-10-01 12:06 ` Markus Armbruster
@ 2015-10-08 13:34 ` Eduardo Otubo
1 sibling, 0 replies; 12+ messages in thread
From: Eduardo Otubo @ 2015-10-08 13:34 UTC (permalink / raw)
To: Namsun Ch'o; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
On Thu, Oct 01, 2015 at 12=36=05AM -0400, Namsun Ch'o wrote:
> The seccomp sandbox doesn't whitelist setuid, setgid, or setgroups, which are
> needed for -runas to work. It also doesn't whitelist chroot, which is needed
> for the -chroot option. Unfortunately, QEMU enables seccomp before it drops
> privileges or chroots, so without these whitelisted, -runas and -chroot cause
> QEMU to be killed with -sandbox on. This patch adds those syscalls.
>
> Signed-off-by: Namsun Ch'o <namnamc@safe-mail.net>
> ---
> diff --git a/qemu-seccomp.c b/qemu-seccomp.c
> index f9de0d3..5cb1809 100644
> --- a/qemu-seccomp.c
> +++ b/qemu-seccomp.c
> @@ -237,7 +237,11 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = {
> { SCMP_SYS(fadvise64), 240 },
> { SCMP_SYS(inotify_init1), 240 },
> { SCMP_SYS(inotify_add_watch), 240 },
> - { SCMP_SYS(mbind), 240 }
> + { SCMP_SYS(mbind), 240 },
> + { SCMP_SYS(setuid), 240 },
> + { SCMP_SYS(setgid), 240 },
> + { SCMP_SYS(chroot), 240 },
> + { SCMP_SYS(setgroups), 240 }
> };
>
> int seccomp_start(void)
Breaking a qemu use case is justification enough to whitelist more
syscalls, but we can come up with a better solution for this (continue
the thread) and tighten up this in the future.
Thanks for your contribution.
Acked-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
ps.: the threads are still being broken by your emails and it's a pain
to track down all of them in order to read. Please fix it.
--
Eduardo Otubo
ProfitBricks GmbH
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
@ 2015-10-02 0:17 namnamc
0 siblings, 0 replies; 12+ messages in thread
From: namnamc @ 2015-10-02 0:17 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, eduardo.otubo
> Should it enable seccomp a bit later?
Ideally it should be enabled as late as possible, right before the main loop,
because here's no reason to whitelist syscalls that are only ever needed to
start QEMU up (e.g. chroot, which is only used before the guest even boots).
But for now, the simplest solution to the -chroot and -runas issue I can
think
of is to enable those syscalls in my patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
@ 2015-10-09 2:09 namnamc
2015-10-09 6:54 ` Markus Armbruster
0 siblings, 1 reply; 12+ messages in thread
From: namnamc @ 2015-10-09 2:09 UTC (permalink / raw)
To: eduardo.otubo; +Cc: qemu-devel
> ps.: the threads are still being broken by your emails and it's a pain
> to track down all of them in order to read. Please fix it.
I'm really sorry, I am not able to sign up to Google because I don't have a
cell number. I'll try using Sigaint. Does it work now?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-09 2:09 namnamc
@ 2015-10-09 6:54 ` Markus Armbruster
2015-10-09 7:24 ` Eduardo Otubo
0 siblings, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2015-10-09 6:54 UTC (permalink / raw)
To: namnamc; +Cc: qemu-devel, eduardo.otubo
namnamc@sigaint.org writes:
>> ps.: the threads are still being broken by your emails and it's a pain
>> to track down all of them in order to read. Please fix it.
>
> I'm really sorry, I am not able to sign up to Google because I don't have a
> cell number. I'll try using Sigaint. Does it work now?
Nope.
Most web mail software sucks. Any particular reason for using a web
browser to send e-mail? I suggest to pick a provider that provides
IMAP, then use a standalone e-mail application such as Thunderbird,
Claws Mail, Mutt or (if you use Emacs) Gnus.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox
2015-10-09 6:54 ` Markus Armbruster
@ 2015-10-09 7:24 ` Eduardo Otubo
0 siblings, 0 replies; 12+ messages in thread
From: Eduardo Otubo @ 2015-10-09 7:24 UTC (permalink / raw)
To: Markus Armbruster; +Cc: namnamc, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 723 bytes --]
On Fri, Oct 09, 2015 at 08=54=33AM +0200, Markus Armbruster wrote:
> namnamc@sigaint.org writes:
>
> >> ps.: the threads are still being broken by your emails and it's a pain
> >> to track down all of them in order to read. Please fix it.
> >
> > I'm really sorry, I am not able to sign up to Google because I don't have a
> > cell number. I'll try using Sigaint. Does it work now?
>
> Nope.
>
> Most web mail software sucks. Any particular reason for using a web
> browser to send e-mail? I suggest to pick a provider that provides
> IMAP, then use a standalone e-mail application such as Thunderbird,
> Claws Mail, Mutt or (if you use Emacs) Gnus.
Exactly.
--
Eduardo Otubo
ProfitBricks GmbH
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-10-09 7:24 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01 4:36 [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot to the seccomp sandbox Namsun Ch'o
2015-10-01 12:06 ` Markus Armbruster
2015-10-02 8:30 ` Daniel P. Berrange
2015-10-02 10:05 ` Markus Armbruster
2015-10-02 14:08 ` Eduardo Otubo
2015-10-02 14:15 ` Daniel P. Berrange
2015-10-02 15:36 ` Eduardo Otubo
2015-10-08 13:34 ` Eduardo Otubo
-- strict thread matches above, loose matches on Subject: below --
2015-10-02 0:17 namnamc
2015-10-09 2:09 namnamc
2015-10-09 6:54 ` Markus Armbruster
2015-10-09 7:24 ` Eduardo Otubo
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).