mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Roland McGrath <roland@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Steven Rostedt <rostedt@goodmis.org>,
	Chris Wright <chrisw@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] check_process_timers: fix possible lockup
Date: Thu, 15 Jun 2006 12:56:31 -0700	[thread overview]
Message-ID: <1150401392.15267.24.camel@cog.beaverton.ibm.com> (raw)
In-Reply-To: <20060615161115.GA21455@oleg>

On Thu, 2006-06-15 at 20:11 +0400, Oleg Nesterov wrote:
> If the local timer interrupt happens just after do_exit() sets PF_EXITING
> (and before it clears ->it_xxx_expires) run_posix_cpu_timers() will call
> check_process_timers() with tasklist_lock + ->siglock held and
> 
> 	check_process_timers:
> 
> 		t = tsk;
> 		do {
> 			....
> 
> 			do {
> 				t = next_thread(t);
> 			} while (unlikely(t->flags & PF_EXITING));
> 		} while (t != tsk);
> 
> the outer loop will never stop.

I believe we've hit the same issue here in the -RT tree. 


> Actually, the window is bigger. Another process can attach the timer after
> ->it_xxx_expires was cleared (see the patch 2/3) and the 'if (PF_EXITING)'
> check in arm_timer() is racy (see the patch 3/3).
> 
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> 
> --- 2.6.17-rc6/kernel/posix-cpu-timers.c~1_CPT	2006-06-15 17:59:15.000000000 +0400
> +++ 2.6.17-rc6/kernel/posix-cpu-timers.c	2006-06-15 18:01:57.000000000 +0400
> @@ -1173,6 +1173,9 @@ static void check_process_timers(struct 
>  		}
>  		t = tsk;
>  		do {
> +			if (unlikely(t->flags & PF_EXITING))
> +				continue;
> +
>  			ticks = cputime_add(cputime_add(t->utime, t->stime),
>  					    prof_left);
>  			if (!cputime_eq(prof_expires, cputime_zero) &&
> @@ -1193,11 +1196,7 @@ static void check_process_timers(struct 
>  					      t->it_sched_expires > sched)) {
>  				t->it_sched_expires = sched;
>  			}
> -
> -			do {
> -				t = next_thread(t);
> -			} while (unlikely(t->flags & PF_EXITING));
> -		} while (t != tsk);
> +		} while ((t = next_thread(t)) != tsk);
>  	}
>  }

This looks equivalent to the fix in -RT.

thanks
-john



      reply	other threads:[~2006-06-15 19:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-15 16:11 Oleg Nesterov
2006-06-15 19:56 ` john stultz [this message]

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=1150401392.15267.24.camel@cog.beaverton.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=chrisw@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®