All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Chapman <doug.chapman@hp.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	adobriyan@gmail.com, Peter Zijlstra <peterz@infradead.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] account_group_exec_runtime: fix the racy usage of ->signal
Date: Fri, 07 Nov 2008 11:58:07 -0500	[thread overview]
Message-ID: <1226077087.6451.18.camel@oberon> (raw)
In-Reply-To: <20081107162101.GA2178@elte.hu>


On Fri, 2008-11-07 at 17:21 +0100, Ingo Molnar wrote:
> * Oleg Nesterov <oleg@redhat.com> wrote:
> 
> > Compile tested.
> > 
> > Unlike other similar routines, account_group_exec_runtime() could be
> > called "implicitly" after exit_notify(). This means we can race with
> > the parent doing release_task(), we can't just check ->signal != NULL.
> > 
> > Take ->siglock to make sure ->signal can't go away.
> > 
> > This is the minimal fix, with this patch we don't need need get/put cpu,
> > and I think we should uninline this function.
> > 
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> 
> > 
> > --- K-28/kernel/sched_stats.h~A_G_E_R_FIX	2008-11-07 17:32:02.000000000 +0100
> > +++ K-28/kernel/sched_stats.h	2008-11-07 17:44:39.000000000 +0100
> > @@ -351,10 +351,12 @@ static inline void account_group_exec_ru
> >  					      unsigned long long ns)
> >  {
> >  	struct signal_struct *sig;
> > +	unsigned long flags;
> >  
> > -	sig = tsk->signal;
> > -	if (unlikely(!sig))
> > +	if (unlikely(!lock_task_sighand(tsk, &flags)))
> >  		return;
> 
> i think this will lock up: the signal lock must not nest inside the rq 
> lock, and these accounting functions are called from within the 
> scheduler.
> 
> 	Ingo

I can confirm that this does hang on bootup.

- Doug



  reply	other threads:[~2008-11-07 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07 16:52 [PATCH] account_group_exec_runtime: fix the racy usage of ->signal Oleg Nesterov
2008-11-07 16:21 ` Ingo Molnar
2008-11-07 16:58   ` Doug Chapman [this message]
2008-11-07 18:42     ` Oleg Nesterov
2008-11-07 17:40   ` Oleg Nesterov
2008-11-08  9:28     ` Ingo Molnar
2008-11-10 13:04       ` Oleg Nesterov
2008-11-10 12:13         ` Peter Zijlstra

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=1226077087.6451.18.camel@oberon \
    --to=doug.chapman@hp.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.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 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.