From: sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
To: Oleg Nesterov <oleg-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>,
daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org,
Nadia Derbey <Nadia.Derbey-6ktuUTfB/bM@public.gmane.org>
Subject: Signals to cinit
Date: Sat, 1 Nov 2008 11:05:05 -0700 [thread overview]
Message-ID: <20081101180505.GA24268@us.ibm.com> (raw)
Signals to container-init
Its been almost a year since we tried to address the signals to
container-init issue. We have two patchsets both of which address
the main issues and should work for current 'sysV init' (since init
explicitly ignores signals it does not handle).
But both patchsets fail in some corner cases and so the approaches
have stalled.
Can we choose one of these approaches and clearly define limitations
(with maybe noisy warnings for known corner-cases) ? That way, cinits
have an option of working-around in user-space till a better solution
is in place.
Or should we explore other, potentially more expensive/intrusive
solutions ?
I have below a brief summary of the two patchsets we tried before
and a very high-level suggestion for an more expensive/intrusive
fix.
Eric's patchset:
https://lists.linux-foundation.org/pipermail/containers/2007-December/009152.html
- Defines a semantic that drops signals to cinit if handler for signal
is SIG_DFL.
- SIG_DFL signal is ignored even when blocked.
- Fails with blocked signal if handler is SIG_DFL when blocked.
cinit: signal set to SIG_DFL
cinit: block signal
ancestor sends a fatal signal to cinit
signal is ignored (since handler is SIG_DFL)
- cinit uses sigtimedwait() for a fatal signal set to SIG_DFL.
The patchset ignores the signal (due to the SIG_DFL).
- /sbin/init blocks SIGCHLD, execs a new program which then installs
a handler for SIGCHLD. But since SIGCHLD == SIG_DFL just after
exec(), the SIGCHLD could be missed.
Oleg's patchset:
Originally posted here:
http://marc.info/?l=linux-kernel&m=118753610515859
An updated patch is included in this mail:
https://lists.linux-foundation.org/pipermail/containers/2007-December/009308.html
- Fails with blocked signals
cinit: block fatal signal
descendant posts signal to cinit
signal is queued since it was blocked
cinit sets handler for signal to SIG_DFL
cinit unblocks signal and terminates even though its from
descendant.
- Fails with ptraced cinit ?
- Drops a signal in sigaction() or get_signal_to_deliver() after we
enqueuing it ("started processing it")
(side-note: But isn't there a precedent for it anyway ?
get_signal_to_deliver() currently does ignore signals it does not
want. sigaction() drops signals that were set to SIG_IGN)
- To quote Eric, "does not start with a 'solid' definition and can
become unmaintainable", but I am not too clear on this comment.
Track ancestor-signals separately: (not implemented)
Add a second 'sigset_t' to sigpending:
struct sigpending {
struct list_head list;
sigset_t signal;
sigset_t ancestor_signal;
};
'ancestor_signal' is only used for container-inits. Global inits
have no ancestors so it is not affected.
If a cinit receives a signal from a descendant, signal gets added
to 'sigpending->signal' set (as is done today).
If cinit receives a signal from an ancestor, signal is added to
'ancestor_signal' set.
When delivering the signal, (maybe in get_signal_to_deliver(), the
cinit can determine if the signal was from ancestor/descendant
and act accordingly.
If the same signal is received from both ancestor and descendant it
would be set in both sets and we make a policy maybe that ancestor
has priority (i.e signal from descendant is ignored/dropped)
Other observations:
- when queuing the signal, we use the same 'sigpending->list'
regardless of the sender's namespace so the order of
processing of signals is unchanged.
- when dequeuing a signal, dequeue from both sets
- when checking for a pending signal (eg: sigkill_pending()),
check the OR of both sets
This would be intrusive since we need to replace reads/writes of
'current->pending.signal' and 'current->signal.shared_pending' with
wrappers.
It maybe a bit more expensive runtime and adds a new 'sigset_t' to
task_struct/signal_struct.
I can send a small prototype if this makes sense at all.
Other approaches to try ?
Thanks,
Sukadev
next reply other threads:[~2008-11-01 18:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-01 18:05 sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8 [this message]
[not found] ` <20081101180505.GA24268-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-11-10 17:38 ` Signals to cinit Oleg Nesterov
[not found] ` <20081110173839.GA11121-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-11-10 18:00 ` Oleg Nesterov
2008-11-10 19:32 ` Oleg Nesterov
2008-11-10 23:27 ` sukadev
2008-11-12 14:52 ` Oleg Nesterov
2008-11-12 16:12 ` Oleg Nesterov
2008-11-12 16:49 ` Serge E. Hallyn
2008-11-12 18:12 ` Sukadev Bhattiprolu
2008-11-12 19:06 ` Serge E. Hallyn
2008-11-11 2:24 ` sukadev
2008-11-12 15:05 ` Oleg Nesterov
2008-11-12 19:04 ` Sukadev Bhattiprolu
2008-11-14 17:26 ` Oleg Nesterov
2008-11-12 16:53 ` Serge E. Hallyn
2008-11-13 19:10 ` Sukadev Bhattiprolu
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=20081101180505.GA24268@us.ibm.com \
--to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=Nadia.Derbey-6ktuUTfB/bM@public.gmane.org \
--cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=oleg-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org \
--cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.