Linux Container Development
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: "David C. Hansen" <haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [PATCH 5/5] Deny external checkpoint unless task is frozen
Date: Wed, 11 Mar 2009 21:26:14 -0700	[thread overview]
Message-ID: <20090312042614.GE8703@us.ibm.com> (raw)
In-Reply-To: <20090312042416.GC7733-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>


From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: [PATCH 5/5] Deny external checkpoint unless task is frozen

Remove a 'FIXME' and ensure that the tasks we are checkpointing are
frozen unless its a self-checkpoint.

Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
 checkpoint/checkpoint.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/checkpoint/checkpoint.c b/checkpoint/checkpoint.c
index 9189abb..cfa6b4f 100644
--- a/checkpoint/checkpoint.c
+++ b/checkpoint/checkpoint.c
@@ -19,6 +19,7 @@
 #include <linux/mount.h>
 #include <linux/utsname.h>
 #include <linux/magic.h>
+#include <linux/freezer.h>
 #include <linux/checkpoint.h>
 #include <linux/checkpoint_hdr.h>
 
@@ -280,7 +281,9 @@ static int cr_may_checkpoint_task(struct task_struct *t, struct cr_ctx *ctx)
 	if (!ptrace_may_access(t, PTRACE_MODE_READ))
 		return -EPERM;
 
-	/* FIXME: verify that the task is frozen (unless self) */
+	/* verify that the task is frozen (unless self) */
+	if (t != current && !frozen(t))
+		return -EBUSY;
 
 	/* FIXME: change this for nested containers */
 	if (task_nsproxy(t) != ctx->root_nsproxy)
-- 
1.5.2.5

  parent reply	other threads:[~2009-03-12  4:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12  4:24 [PATCH 0/5] Missing patches in Dave Hansen's tree Sukadev Bhattiprolu
     [not found] ` <20090312042416.GC7733-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-12  4:25   ` [PATCH 1/5] Track in-kernel when we expect checkpoint/restart to work Sukadev Bhattiprolu
     [not found]     ` <20090312042503.GA8703-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-12 16:57       ` Serge E. Hallyn
2009-03-12  4:25   ` [PATCH 2/5] Checkpoint multiple processes Sukadev Bhattiprolu
2009-03-12  4:25   ` [PATCH 3/5] Restart " Sukadev Bhattiprolu
2009-03-12  4:25   ` [PATCH 4/5] Check 'may_checkpoint()' early Sukadev Bhattiprolu
     [not found]     ` <20090312042559.GD8703-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-12 17:33       ` Serge E. Hallyn
2009-03-12  4:26   ` Sukadev Bhattiprolu [this message]
     [not found]     ` <20090312042614.GE8703-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-12 17:37       ` [PATCH 5/5] Deny external checkpoint unless task is frozen Serge E. Hallyn
     [not found]         ` <20090312173707.GC17253-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-13  3:19           ` Oren Laadan
     [not found]             ` <49B9D0BD.40701-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-13 13:54               ` Serge E. Hallyn

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=20090312042614.GE8703@us.ibm.com \
    --to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=haveblue-r/Jw6+rmf7HQT0dZR+AlfA@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