From: "Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>
To: util-linux <util-linux@vger.kernel.org>, ebiederm@xmission.com
Cc: systemd-devel@lists.freedesktop.org
Subject: nsenter and SIGSTOP
Date: Sat, 20 Apr 2013 20:23:19 +0200 [thread overview]
Message-ID: <20130420182319.GU3394@in.waw.pl> (raw)
In-Reply-To: <20130417155727.GE19116@tango.0pointer.de>
Hi,
I've hit a bit of a problem with nsenter and systemd-nspawn.
When nsenter is used to enter the PID namespace created with
systemd-nspawn, and the container's init attempts a shutdown,
it hangs because nsenter is suspended.
The sequence of events leading to the hang is:
1. nsenter launches a shell inside the container with
PPID=0 as seen inside the container,
2. systemd with PID=1 goes through the shutdown sequence,
issuing the equivalent(*) of
kill(-1, SIGSTOP)
kill(-1, SIGTERM)
kill(_1, SIGCONT)
reboot(RB_HALT_SYSTEM)
Now, nsenter has a stanza in continue_as_child where it stops itself
when the child gets stopped. Unfortunately, this means that nsenter
gets stopped in response to kill(-1, SIGSTOP) which hits the child.
Then the child dies on kill(-1, SIGTERM), is resumed with kill(-1,
SIGCONT) and exits (it prints "exit", so it's easy to see that it
terminated properly. Then the shell becomes a zombie, since nsenter it
it's parent and it's sleeping. Meanwhile, init executes reboot, and
hangs in there, since the container waits for the PID namespace to
become empty (I'm guessing here, but that seems logical). When then
I type 'fg' to continue nsenter, the child gets collected and the
container successfully exits.
This is with kernel 3.9-rc6 from Fedora.
Thanks,
Zbyszek
next parent reply other threads:[~2013-04-20 19:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130417155727.GE19116@tango.0pointer.de>
2013-04-20 18:23 ` Zbigniew Jędrzejewski-Szmek [this message]
2013-04-20 22:27 ` [systemd-devel] nsenter and SIGSTOP Eric W. Biederman
2013-04-21 13:21 ` Lennart Poettering
2013-04-21 14:45 ` Zbigniew Jędrzejewski-Szmek
2013-04-21 14:50 ` [not-for-applying PATCH] nsenter: do not self-suspend if child is suspended Zbigniew Jędrzejewski-Szmek
2013-04-21 16:18 ` nsenter and SIGSTOP Eric W. Biederman
2013-04-21 19:33 ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
2013-04-21 22:07 ` Eric W. Biederman
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=20130420182319.GU3394@in.waw.pl \
--to=zbyszek@in.waw.pl \
--cc=ebiederm@xmission.com \
--cc=systemd-devel@lists.freedesktop.org \
--cc=util-linux@vger.kernel.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