Linux Container Development
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Dave Hansen
	<dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [RFC v14-rc3][PATCH 13/36] External checkpoint of a task other than ourself
Date: Wed, 15 Apr 2009 21:45:41 -0700	[thread overview]
Message-ID: <20090416044541.GA14128@us.ibm.com> (raw)
In-Reply-To: <1239107264-21775-14-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>

Oren Laadan [orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org] wrote:
| +static int cr_get_container(struct cr_ctx *ctx, pid_t pid)
| +{
| +	struct task_struct *task = NULL;
| +	struct nsproxy *nsproxy = NULL;
| +	int err = -ESRCH;
| +
| +	ctx->root_pid = pid;
| +
| +	read_lock(&tasklist_lock);
| +	task = find_task_by_vpid(pid);
| +	if (task)
| +		get_task_struct(task);
| +	read_unlock(&tasklist_lock);
| +
| +	if (!task)
| +		goto out;
| +
| +#if 0	/* enable to use containers */
| +	if (!is_container_init(task)) {
| +		err = -EINVAL;
| +		goto out;
| +	}
| +#endif
| +
| +	if (!ptrace_may_access(task, PTRACE_MODE_READ)) {
| +		err = -EPERM;
| +		goto out;
| +	}
| +
| +	/* verify that the task is frozen (unless self) */
| +	if (task != current && !frozen(task))
| +		return -EBUSY;
| +
| +	rcu_read_lock();
| +	nsproxy = task_nsproxy(task);
| +	get_nsproxy(nsproxy);

You were probably addressing my earlier comment :-), but if nsproxy
is NULL, get_nsproxy() will crash the system.

Would be nice if get_nsproxy() is modified to check for NULL and return
the nsproxy, (like say get_ipc_ns()), so we can:

	rcu_read_lock();
	nsproxy = get_nsproxy(task_nsproxy(task));
	rcu_read_unlock();

	if (!nsproxy)
		goto out;


| +	rcu_read_unlock();
| +
| +	if (!nsproxy)
| +		goto out;
| +
| +	ctx->root_task = task;
| +	ctx->root_nsproxy = nsproxy;
| +
| +	return 0;

Sukadev

  parent reply	other threads:[~2009-04-16  4:45 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 12:27 [RFC v14-rc3][PATCH 00/36] Kernel based checkpoint/restart Oren Laadan
     [not found] ` <1239107264-21775-1-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 01/36] Create syscalls: sys_checkpoint, sys_restart Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 02/36] Checkpoint/restart: initial documentation Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 03/36] Make file_pos_read/write() public Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 04/36] General infrastructure for checkpoint restart Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 05/36] x86 support for checkpoint/restart Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 06/36] Dump memory address space Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 07/36] Restore " Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 08/36] Infrastructure for shared objects Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 09/36] Dump open file descriptors Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 10/36] actually use f_op in checkpoint code Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 11/36] add generic checkpoint f_op to ext fses Oren Laadan
     [not found]     ` <1239107264-21775-12-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09  1:59       ` Serge E. Hallyn
     [not found]         ` <20090409015926.GA20112-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-09  2:29           ` Serge E. Hallyn
     [not found]             ` <20090409022940.GA22284-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-12  3:42               ` Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 12/36] Restore open file descriptors Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 13/36] External checkpoint of a task other than ourself Oren Laadan
     [not found]     ` <1239107264-21775-14-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-16  4:45       ` Sukadev Bhattiprolu [this message]
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 14/36] c/r of restart-blocks: export functionality used in next patch Oren Laadan
     [not found]     ` <1239107264-21775-15-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09 21:07       ` Serge E. Hallyn
2009-04-16  5:00       ` Sukadev Bhattiprolu
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 15/36] c/r of restart-blocks Oren Laadan
     [not found]     ` <1239107264-21775-16-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-07 18:14       ` Dan Smith
     [not found]         ` <87r6042uwm.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-04-07 18:44           ` Oren Laadan
     [not found]             ` <49DB9F01.4050605-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-07 19:05               ` Dan Smith
     [not found]                 ` <87myas2sjr.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-04-08  2:24                   ` Oren Laadan
2009-04-16  6:02       ` Sukadev Bhattiprolu
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 16/36] Checkpoint multiple processes Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 17/36] Restart " Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 18/36] A new file type (CR_FD_OBJREF) for a file descriptor already setup Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 19/36] Checkpoint open pipes Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 20/36] Restore " Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 21/36] Record 'struct file' object instead of the file name for VMAs Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 22/36] Prepare to support shared memory Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 23/36] Dump anonymous- and file-mapped- " Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 24/36] Restore " Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 25/36] s390: Expose a constant for the number of words representing the CRs Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 26/36] c/r: Add CR_COPY() macro (v4) Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 27/36] s390: define s390-specific checkpoint-restart code (v7) Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 28/36] powerpc: provide APIs for validating and updating DABR Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 29/36] powerpc: checkpoint/restart implementation Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 30/36] powerpc: wire up checkpoint and restart syscalls Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 31/36] powerpc: enable checkpoint support in Kconfig Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 32/36] Export fs/exec.c:exec_mmap() Oren Laadan
     [not found]     ` <1239107264-21775-33-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09 21:06       ` Serge E. Hallyn
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 33/36] Support for share memory address spaces Oren Laadan
     [not found]     ` <1239107264-21775-34-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09 21:03       ` Serge E. Hallyn
     [not found]         ` <20090409210302.GA5115-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-09 22:13           ` Oren Laadan
     [not found]             ` <49DE72F7.9040001-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09 22:52               ` Serge E. Hallyn
     [not found]                 ` <20090409225212.GA8386-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-09 23:17                   ` Oren Laadan
     [not found]                     ` <Pine.LNX.4.64.0904091912440.12600-CXF6herHY6ykSYb+qCZC/1i27PF6R63G9nwVQlTi/Pw@public.gmane.org>
2009-04-10  0:09                       ` Serge E. Hallyn
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 34/36] Make cr_may_checkpoint_task() check each namespace individually Oren Laadan
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 35/36] c/r: Add UTS support (v6) Oren Laadan
     [not found]     ` <1239107264-21775-36-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09 21:17       ` Serge E. Hallyn
2009-04-07 12:27   ` [RFC v14-rc3][PATCH 36/36] Stub implementation of IPC namespace c/r Oren Laadan
     [not found]     ` <1239107264-21775-37-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-09 21:29       ` Serge E. Hallyn
     [not found]         ` <20090409212939.GD5115-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-12  3:46           ` Oren Laadan
     [not found]             ` <49E163FC.4080306-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-04-13 14:10               ` Serge E. Hallyn
     [not found]                 ` <20090413141022.GA13007-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-04-13 14:23                   ` Dan Smith

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=20090416044541.GA14128@us.ibm.com \
    --to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@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