All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
To: Sukadev Bhattiprolu
	<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: Re: [PATCH][usercr]: Ghost tasks must be detached
Date: Thu, 10 Feb 2011 09:56:28 -0500	[thread overview]
Message-ID: <4D53FC9C.1050405@cs.columbia.edu> (raw)
In-Reply-To: <20110210061730.GA25432-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>



On 02/10/2011 01:17 AM, Sukadev Bhattiprolu wrote:
> Oren Laadan [orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org] wrote:
> | 
> | To address this, initially I thought that we could make ghosts take
> | the tasklist_lock (write) when they change their ->exit_signal. 
> | 
> | But that's not enough because the parent may already be blocked in
> | wait (so it's too late). Therefore, we also need to have ghosts 
> | wake-up their parent through __wake_up_parent().
> | 
> | so something like:
> | 
> | void ghost_auto_reapable()
> | {
> | 	write_lock(&tasklist_lock);
> | 	current->exit_signal = -1;
> | 	__wake_up_sync_key(current, current->parent);
> | 	write_unlock(&tasklist_lock);
> 
> You meant __wake_up_parent() here I guess.

Yes...

> 
> But if we do this in do_ghost_task(), the parent could wakeup, find
> that it still has a live child (this ghost) and go back to sleep before
> the ghost becomes EXIT_DEAD right ?

You are right again...

> 
> If so, we would still have the problem ?
> 
> i.e we must stop being a chld a of the cinit for it to not wait for us.
> Or we might need to detect that the the pidns is going away, so signalling
> the parent won't cause any harm.  But that is racy too :-(

So instead, we can call __wake_up_parent() from exit_checkpoint()
if indeed we are already reaped there:

exit_checkpoint()
{
	...
	if (current->flags & PF_RESTARTING) {
		...
		/* either zombie or reaped ghost/dead */
		if (current->exit_state = EXIT_DEAD)
			__wake_up_parent(...);	  /* probably need lock */
		...
	}
	...
}

and to avoid userspace misuse, disallow non-thread-group-leader ghosts.

?

Oren.

> 
> | }
> | 
> | If the parent wasn't at all waiting for us, no harm done...
> | 
> | > 
> | > So you may ask how did the container-init have a ghost child. That was
> | > due to a bug in usercr :-). 
> | 
> | You don't need a bug: the ghost flag is used for both ghost and dead
> | tasks (the former used to instantiate specific pids, the latter to
> | make other tasks orphans). So restarting a container that had orphan
> | tasks is guaranteed to do this.
> 
> Ah, thats a good point.
> 

  parent reply	other threads:[~2011-02-10 14:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-11  3:35 [PATCH][usercr]: Ghost tasks must be detached Sukadev Bhattiprolu
     [not found] ` <20101211033548.GA12584-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-01-11  1:51   ` Oren Laadan
     [not found]     ` <4D2BB78A.9090701-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-05 18:55       ` Oren Laadan
     [not found]         ` <4D4D9D1B.3000209-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-05 21:40           ` Sukadev Bhattiprolu
     [not found]             ` <20110205214032.GA12944-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-05 22:02               ` Oren Laadan
     [not found]                 ` <4D4DC90B.3010103-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-05 22:33                   ` Oren Laadan
2011-02-09  2:09                   ` Sukadev Bhattiprolu
     [not found]                     ` <20110209020942.GA5339-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-09  3:35                       ` Oren Laadan
     [not found]                         ` <4D520B78.9020300-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-10  2:44                           ` Sukadev Bhattiprolu
     [not found]                             ` <20110210024430.GA23167-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-10  3:53                               ` Oren Laadan
     [not found]                                 ` <4D536154.8000900-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-10  6:17                                   ` Sukadev Bhattiprolu
     [not found]                                     ` <20110210061730.GA25432-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-10 14:56                                       ` Oren Laadan [this message]
     [not found]                                         ` <4D53FC9C.1050405-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-10 17:42                                           ` Sukadev Bhattiprolu
2011-02-16 20:10                                           ` Sukadev Bhattiprolu
     [not found]                                             ` <20110216201019.GA27698-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-17 15:21                                               ` Louis Rilling
     [not found]                                                 ` <20110217152116.GM518-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2011-02-21 20:40                                                   ` Sukadev Bhattiprolu
     [not found]                                                     ` <20110221204058.GC14377-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-22 10:28                                                       ` Louis Rilling
2011-02-09 12:01                       ` Louis Rilling
     [not found]                         ` <20110209120100.GD13323-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2011-02-09 12:18                           ` Oren Laadan
     [not found]                             ` <4D528629.7030905-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2011-02-09 12:35                               ` Louis Rilling
     [not found]                                 ` <20110209123550.GG13323-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2011-02-09 12:37                                   ` Louis Rilling
2011-02-09 19:02                           ` Sukadev Bhattiprolu
     [not found]                             ` <20110209190216.GA17051-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-10 10:23                               ` Louis Rilling
     [not found]                                 ` <20110210102312.GC6360-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2011-02-10 17:54                                   ` Sukadev Bhattiprolu
     [not found]                                     ` <20110210175409.GB1025-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-10 18:04                                       ` Louis Rilling
     [not found]                                         ` <20110210180433.GI6360-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2011-02-10 22:31                                           ` Sukadev Bhattiprolu
2011-02-25  7:58   ` Sukadev Bhattiprolu
     [not found]     ` <20110225075808.GC24361-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2011-02-25 15:46       ` 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=4D53FC9C.1050405@cs.columbia.edu \
    --to=orenl-eqauephvms7envbuuze7ea@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.