Linux Container Development
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: [RFC] checkpoint: handle more siginfo->si_code values
Date: Thu, 17 Jun 2010 17:37:39 -0500	[thread overview]
Message-ID: <1276814259.6401.21.camel@localhost> (raw)

I have a multithreaded testcase that easily hits the BUG() in
fill_siginfo() by raise()'ing a signal it has blocked before
checkpoint.  The value of si_code in this case is SI_TKILL.

This gets my testcase to pass, but I'm not sure it's a complete
solution...  comments?
---
 kernel/signal.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index e4ca9a6..cd25592 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2919,6 +2919,9 @@ static void fill_siginfo(struct ckpt_siginfo *si, siginfo_t *info)
 	si->_errno = info->si_errno;
 	si->code = info->si_code;
 
+	if (info->si_code < 0)
+		return;
+
 	/* TODO: convert info->si_uid to uid_objref */
 
 	switch (info->si_code & __SI_MASK) {
@@ -2953,7 +2956,8 @@ static void fill_siginfo(struct ckpt_siginfo *si, siginfo_t *info)
 		si->sigval_ptr = (unsigned long) info->si_ptr;
 		break;
 	default:
-		BUG();
+		ckpt_debug("unknown si_code 0x%x\n", info->si_code);
+		break;
 	}
 }
 
@@ -3002,7 +3006,7 @@ static int load_siginfo(siginfo_t *info, struct ckpt_siginfo *si)
 		info->si_ptr = (void __user *) (unsigned long) si->sigval_ptr;
 		break;
 	default:
-		return -EINVAL;
+		break;
 	}
 
 	return 0;
-- 
1.6.0.2

             reply	other threads:[~2010-06-17 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17 22:37 Nathan Lynch [this message]
2010-06-18 15:58 ` [RFC] checkpoint: handle more siginfo->si_code values 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=1276814259.6401.21.camel@localhost \
    --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