mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@debian.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: do_syslog/__down_trylock lockup in current BK
Date: Mon, 9 Sep 2002 16:40:26 -0400	[thread overview]
Message-ID: <20020909204026.GA8719@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0209092230550.16779-100000@localhost.localdomain>

On Mon, Sep 09, 2002 at 10:33:17PM +0200, Ingo Molnar wrote:
> 
> the attached patch fixes one bug in the way we did zap_thread() - but this
> alone does not fix the lockup.
> 
> the bug was that list_for_each_safe() is not 'safe enough' - zap_thread()  
> drops the tasklist lock at which point anything might happen to the child
> list.
> 
> the lockup is likely in the while loop - ie. zap_thread() not actually
> reparenting a thread and thus causing an infinite loop - is that possible?

Well, it shouldn't be.  forget_original_parent should update
real_parent for every child on either list, and then zap_thread unlinks
each child from the current parent and links it to the new real_parent.
A couple of printks in there should be able to work out if I'm wrong,
though...

> @@ -554,17 +553,16 @@
>  		do_notify_parent(current, current->exit_signal);
>  
>  zap_again:
> -	list_for_each_safe(_p, _n, &current->children)
> -		zap_thread(list_entry(_p,struct task_struct,sibling), current, 0);
> -	list_for_each_safe(_p, _n, &current->ptrace_children)
> -		zap_thread(list_entry(_p,struct task_struct,ptrace_list), current, 1);
> +	while (!list_empty(&current->children))
> +		zap_thread(list_entry(current->children.next,struct task_struct,sibling), current, 0);
> +	while (!list_empty(&current->ptrace_children))
> +		zap_thread(list_entry(current->ptrace_children.next,struct task_struct,sibling), current, 0);

As Linus points out, typo right there on the last argument.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

  reply	other threads:[~2002-09-09 20:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-09 18:53 Ingo Molnar
2002-09-09 19:01 ` Linus Torvalds
2002-09-09 19:08   ` Ingo Molnar
2002-09-09 19:18     ` Ingo Molnar
2002-09-09 20:02       ` Ingo Molnar
2002-09-09 20:15         ` Daniel Jacobowitz
2002-09-09 20:25           ` Ingo Molnar
2002-09-09 20:33           ` Ingo Molnar
2002-09-09 20:40             ` Daniel Jacobowitz [this message]
2002-09-09 20:58               ` Ingo Molnar
2002-09-09 20:40             ` Linus Torvalds
2002-09-09 20:45               ` Ingo Molnar
2002-09-09 20:43           ` Ingo Molnar
2002-09-09 20:50             ` Daniel Jacobowitz
2002-09-09 21:00               ` Ingo Molnar

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=20020909204026.GA8719@nevyn.them.org \
    --to=dan@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®