Skip to contentSkip to conversation

Deny external checkpoint unless frozen

PATCH In review Sukadev Bhattiprolu 4 participants 8 messages Feb 21, 2009 – Mar 18, 2009 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Deny external checkpoint unless frozen

From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 21 Feb 2009 11:17:07 -0800
Subject: [PATCH] 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.

---
 checkpoint/checkpoint.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
checkpoint/checkpoint.c +4 -1
index 2bbb409..023bd9d 100644
@@ -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)
Signature · 1 line
1.5.2.5

A message that is not in the archive (sent off-list or not yet received): 20090221201317.GB13532-r/[email protected]

#2 lore raw
Quoted 9 lines · Sukadev Bhattiprolu

From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 21 Feb 2009 11:17:07 -0800
Subject: [PATCH] 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.

Agreed. I personally would like to just get rid of support for t==current, but don't expect to get anywhere with that argument :)

Quoted 29 lines
---
 checkpoint/checkpoint.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
checkpoint/checkpoint.c +4 -1
index 2bbb409..023bd9d 100644
@@ -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)
Signature · 1 line
1.5.2.5

A message that is not in the archive (sent off-list or not yet received): 20090223230438.GA2590-r/[email protected]

#4 lore raw
Quoted 6 lines · Serge E. Hallyn
Quoted 5 lines · Sukadev Bhattiprolu

From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 21 Feb 2009 11:17:07 -0800
Subject: [PATCH] Deny external checkpoint unless task is frozen

Quoted 8 lines
Quoted 4 lines

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

Agreed. I personally would like to just get rid of support for t==current, but don't expect to get anywhere with that argument :)

Along the lines of what Ingo has been asking for, do we need to expose this logic in some way? Do we need a /proc/$$/checkpointable file which says, "I'm not checkpointable because I'm not frozen"?

Or, is this just a core part of the API: you have to freeze before checkpointing? As such, we'll never move to a place where we're not frozen when checkpointing, so we might as well not even track or expose it.

-- Dave

#5 lore raw
Quoted 12 lines · Dave Hansen
Quoted 11 lines · Serge E. Hallyn
Quoted 9 lines · Sukadev Bhattiprolu

From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 21 Feb 2009 11:17:07 -0800
Subject: [PATCH] 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.

Quoted 7 lines
Quoted 3 lines

Agreed. I personally would like to just get rid of support for t==current, but don't expect to get anywhere with that argument :)

Along the lines of what Ingo has been asking for, do we need to expose this logic in some way? Do we need a /proc/$$/checkpointable file which says, "I'm not checkpointable because I'm not frozen"?

I really like that.

Quoted 4 lines

Or, is this just a core part of the API: you have to freeze before checkpointing? As such, we'll never move to a place where we're not frozen when checkpointing, so we might as well not even track or expose it.

the only way that would make sense is if sys_checkpoint went ahead and frozen them all, right?

-serge

A message that is not in the archive (sent off-list or not yet received): 20090224010945.GA4797-r/[email protected]

#7 lore raw
Quoted 11 lines · Serge E. Hallyn
Quoted 8 lines
Quoted 4 lines

Agreed. I personally would like to just get rid of support for t==current, but don't expect to get anywhere with that argument :)

Along the lines of what Ingo has been asking for, do we need to expose this logic in some way? Do we need a /proc/$$/checkpointable file which says, "I'm not checkpointable because I'm not frozen"?

I really like that.

Quoted 7 lines
Quoted 4 lines

Or, is this just a core part of the API: you have to freeze before checkpointing? As such, we'll never move to a place where we're not frozen when checkpointing, so we might as well not even track or expose it.

the only way that would make sense is if sys_checkpoint went ahead and frozen them all, right?

Yeah, I agree with that.

Does this mean Suka has to do the patch? ;)

-- Dave

#8 lore raw
Quoted 17 lines · Dave Hansen
Quoted 16 lines · Serge E. Hallyn
Quoted 8 lines
Quoted 4 lines

Agreed. I personally would like to just get rid of support for t==current, but don't expect to get anywhere with that argument :)

Along the lines of what Ingo has been asking for, do we need to expose this logic in some way? Do we need a /proc/$$/checkpointable file which says, "I'm not checkpointable because I'm not frozen"?

I really like that.

Quoted 4 lines

Or, is this just a core part of the API: you have to freeze before checkpointing? As such, we'll never move to a place where we're not frozen when checkpointing, so we might as well not even track or expose it.

Quoted 6 lines
Quoted 2 lines

the only way that would make sense is if sys_checkpoint went ahead and frozen them all, right?

Yeah, I agree with that.

Does this mean Suka has to do the patch? ;)

Heh.

Well the patch is mainly on top of your patchset which defines the string holding reasons for uncheckpointability, right? I assume you've modified that since then (too bad we're on a patch model at the moment) so seems easiest for you to toss it on top of your set.

Or you can send your latest version and I (or Suka) can write the /proc/$$/checkpointable file.

-serge

A message that is not in the archive (sent off-list or not yet received): 20090224183116.GA21891-r/[email protected]

#10 lore raw
Quoted 8 lines · Serge E. Hallyn

Well the patch is mainly on top of your patchset which defines the string holding reasons for uncheckpointability, right? I assume you've modified that since then (too bad we're on a patch model at the moment) so seems easiest for you to toss it on top of your set.

Or you can send your latest version and I (or Suka) can write the /proc/$$/checkpointable file.

What I have so far is actually only for fds and uses /proc/$$/fdinfo/*. I haven't done the per-task file yet.

-- Dave

#11 lore raw
In reply to a message not in the archive

Fixed.

Quoted 35 lines · Sukadev Bhattiprolu

From: Sukadev Bhattiprolu <[email protected]>
Date: Sat, 21 Feb 2009 11:17:07 -0800
Subject: [PATCH] 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.

---
 checkpoint/checkpoint.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
checkpoint/checkpoint.c +4 -1
index 2bbb409..023bd9d 100644
@@ -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)