From: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH] user-cr: invoke exit system call directly from ckpt_do_feeder
Date: Tue, 24 Nov 2009 18:20:04 -0600 [thread overview]
Message-ID: <1259108404.10928.3.camel@localhost.localdomain> (raw)
The feeder thread can cause the restart process to fail by indirectly
calling exit_group, which sends SIGKILL to all other threads in the
process. If the feeder thread "wins" the race, the restart is
disrupted. A common symptom of this race is the coordinator task
returning from the wait_for_completion_interruptible in
wait_all_tasks_finish with a signal (the SIGKILL) pending.
Calling _exit isn't enough; see
http://www.kernel.org/doc/man-pages/online/pages/man2/exit.2.html#NOTES
Exit the feeder thread by using the syscall() macro.
Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
---
restart.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/restart.c b/restart.c
index d5d069a..ed4268c 100644
--- a/restart.c
+++ b/restart.c
@@ -2079,8 +2079,16 @@ static int ckpt_do_feeder(void *data)
ckpt_read_write_inspect(ctx);
else
ckpt_read_write_blind(ctx);
-
- /* all is well: feeder thread is done */
+
+ /* All is well: feeder thread is done. However, we must
+ * invoke the exit system call directly. Otherwise, upon
+ * return from this function, glibc's clone wrapper will call
+ * _exit, which calls exit_group, which will terminate the
+ * whole process, which is not what we want.
+ */
+ syscall(SYS_exit, 0);
+
+ /* not reached */
return 0;
}
--
1.6.0.6
next reply other threads:[~2009-11-25 0:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 0:20 Nathan Lynch [this message]
[not found] ` <1259108404.10928.3.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-11-25 18:35 ` [PATCH] user-cr: invoke exit system call directly from ckpt_do_feeder Oren Laadan
2009-11-26 15:10 ` Oren Laadan
[not found] ` <4B0E9A57.4020501-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-11-30 18:14 ` Nathan Lynch
[not found] ` <1259604874.6060.41.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-12-01 7:12 ` Oren Laadan
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=1259108404.10928.3.camel@localhost.localdomain \
--to=ntl-e+axbwqsrlaavxtiumwx3w@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=orenl-eQaUEPhvms7ENvBUuze7eA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox