From: Stefan Hajnoczi <stefanha@gmail.com>
To: Will Drewry <wad@chromium.org>
Cc: Corey Bryant <coreyb@linux.vnet.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
Paul Moore <pmoore@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>,
Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Otubo <otubo@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH for-1.7] seccomp: setting "-sandbox on" by default
Date: Fri, 6 Dec 2013 10:13:33 +0100 [thread overview]
Message-ID: <20131206091333.GB2616@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CABqD9hacjUPCuitDMRx+rU_pSK0i-tT3hGYcwc2nsduvYZLqhA@mail.gmail.com>
On Thu, Dec 05, 2013 at 10:12:00AM -0600, Will Drewry wrote:
> On Thu, Dec 5, 2013 at 7:15 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> > On Wed, Dec 04, 2013 at 11:21:12AM -0200, Eduardo Otubo wrote:
> >> On 12/04/2013 07:39 AM, Stefan Hajnoczi wrote:
> >> >On Fri, Nov 22, 2013 at 11:00:24AM -0500, Paul Moore wrote:
> >> >>>Developers will only be happy with seccomp if it's easy and rewarding to
> >> >>>support/debug.
> >> >>
> >> >>Agreed.
> >> >>
> >> >>As a developer, how do you feel about the audit/syslog based approach I
> >> >>mentioned earlier?
> >> >
> >> >I used the commands you posted (I think that's what you mean). They
> >> >produce useful output.
> >> >
> >> >The problem is that without an error message on stderr or from the
> >> >shell, no one will think "QEMU process dead and hung == check seccomp"
> >> >immediately. It's frustrating to deal with a "silent" failure.
> >>
> >> The process dies with a SIGKILL, and sig handling in Qemu is hard to
> >> implement due to dozen of external linked libraries that has their
> >> own signal masks and conflicts with seccomp. I've already tried this
> >> approach in the past (you can find in the list by searching for
> >> debug mode)
> >
> > I now realize we may be talking past each other. Dying with
> > SIGKILL/SIGSYS is perfectly reasonable and I would be happy with that
> > :-).
> >
> > But I think there's a bug in seccomp: a multi-threaded process can be
> > left in a zombie state. In my case the primary thread was killed by
> > seccomp but another thread was deadlocked on a futex.
> >
> > The result is the process isn't quite dead yet. The shell will not reap
> > it and we're stuck with a zombie.
> >
> > I can reproduce it reliably when I run "qemu-system-x86_64 -sandbox on"
> > on Fedora 20 (qemu-system-x86-1.6.1-2).
> >
> > Should seccomp use do_group_exit() for SIGKILL?
>
> Is the problem that the SECCOMP_RET_KILL didn't take down the thread
> group (which would be a departure from how seccomp(mode=1) worked) and
> causes the deadlock somehow, or is it that the other thread is
> deadlocked?
The former.
When the first thread is killed by seccomp, the second thread in the
process is left waiting on a futex forever. Therefore the process never
exits after the seccomp violation occurs.
Directing the signal at a thread makes perfect sense for
SECCOMP_RET_TRAP since the thread can handle the signal and recover.
But for SECCOMP_RET_KILL it's probably more useful to kill the entire
process rather than just a single thread.
> Regardless, adding a SECCOMP_RET_TGKILL probably isn't a bad idea :)
Yes. Do you have time for that or would you like me to send a patch?
Stefan
next prev parent reply other threads:[~2013-12-06 9:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 11:21 [Qemu-devel] [PATCH for-1.7] seccomp: setting "-sandbox on" by default Eduardo Otubo
2013-10-22 13:00 ` Anthony Liguori
2013-10-23 14:42 ` Eduardo Otubo
2013-10-30 10:04 ` Stefan Hajnoczi
2013-11-21 15:14 ` Paolo Bonzini
2013-11-21 15:48 ` Paul Moore
2013-11-21 16:22 ` Eduardo Otubo
2013-11-22 10:39 ` Stefan Hajnoczi
2013-11-22 14:44 ` Paul Moore
2013-11-22 15:48 ` Stefan Hajnoczi
2013-11-22 16:00 ` Paul Moore
2013-12-04 9:39 ` Stefan Hajnoczi
2013-12-04 13:21 ` Eduardo Otubo
2013-12-04 14:46 ` Corey Bryant
2013-12-05 13:15 ` Stefan Hajnoczi
2013-12-05 16:12 ` Will Drewry
2013-12-06 9:13 ` Stefan Hajnoczi [this message]
2013-12-06 15:40 ` Will Drewry
2013-12-07 8:13 ` Stefan Hajnoczi
2013-11-22 10:34 ` Stefan Hajnoczi
2013-11-22 14:38 ` Paul Moore
2013-12-04 13:17 ` Eduardo Otubo
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=20131206091333.GB2616@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=anthony@codemonkey.ws \
--cc=coreyb@linux.vnet.ibm.com \
--cc=otubo@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=pmoore@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wad@chromium.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).