mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Katz <jeremy.katz@windriver.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Ingo Molnar <mingo@elte.hu>, Stable Team <stable@kernel.org>
Subject: Re: [PATCH] posix-timer: fix deletion race
Date: Mon, 23 Jul 2007 19:07:37 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.63.0707231858420.9759@localhost.localdomain> (raw)
In-Reply-To: <20070720141529.GA218@tv-sign.ru>

On Fri, 20 Jul 2007, Oleg Nesterov wrote:

> On 07/18, Jeremy Katz wrote:
>>
>> On Wed, 18 Jul 2007, Oleg Nesterov wrote:
>>
>>> Jeremy, I agree with Thomas that your patch should not be right, but it
>>> does make a difference. Perhaps this is just the timing, but who knows.
>>> Could you add some printk's to be sure that lock_timer() actually fails
>>> while it never should?
>>
>> Agreed.
>>
>> Unfortunately, adding any significant output appears to alter the
>> situation to the point where the issue either does not occur, or takes
>> significantly longer to surface.
>
> No, no, I didn't mean any significant output. You changed itimer_delete()
>
> 	>  -       spin_lock_irqsave(&timer->it_lock, flags);
> 	>  +       /* timer already deleted? */
> 	>  +       if (lock_timer(timer->it_id, &flags) == NULL)
> 	>  +               return;
>
> This change should not help, lock_timer() should always succeed here.
> But since it makes a difference, we can make something like
>
> 	if (lock_timer(timer->it_id, &flags) == NULL) {
> 		printk("Impossible! but it happened.\n");
> 		return;
> 	}
>
> The same for posix_timer_fn().

Ahh, of course.  I did try that at some point, and remember seeing at 
least the occasional failure.  This time, taking the spinlock and then 
checking for a valid timer ID, I did not see the locking fail.  I did see 
the attempt to use a freed sigqueue, further suggesting my 'fix' merely 
altered the timing sufficiently to hide the issue.

> I still can't believe we have a double-free problem, this looks imposiible.
> Do you see the
>
> 	"idr_remove called for id=%d which is not allocated.\n"
>
> in syslog?

No.  I also added some accounting with atomic counters, and don't see 
evidence of a second call to release_posix_timer.

> Could you try the patch below? Perhaps we have some wierd problem with
> ->sigq corruption.

Tried, with apparent effect.

To add to the body of data: Turning off hyperthreading in the hardware 
does not resolve the issue.  Limiting the system to one CPU does appear to 
work.


Jeremy

  reply	other threads:[~2007-07-24  2:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-13 18:19 POSIX timer deletion race? Jeremy Katz
2007-07-17  8:53 ` [PATCH] posix-timer: fix deletion race Thomas Gleixner
2007-07-17  9:57   ` Ingo Molnar
2007-07-17 18:29     ` Jeremy Katz
2007-07-17 13:07   ` Oleg Nesterov
2007-07-17 17:02     ` Thomas Gleixner
2007-07-17 18:39   ` Jeremy Katz
2007-07-17 20:17     ` Thomas Gleixner
2007-07-17 23:12       ` Jeremy Katz
2007-07-17 23:58         ` Jeremy Katz
2007-07-18  6:05           ` Thomas Gleixner
2007-07-18  6:58             ` Thomas Gleixner
2007-07-18 19:02               ` Jeremy Katz
2007-07-18 23:43                 ` Jeremy Katz
2007-07-19  5:50                   ` Thomas Gleixner
2007-07-19 19:24                     ` Jeremy Katz
2007-07-18 16:11           ` Oleg Nesterov
2007-07-18 19:08             ` Jeremy Katz
2007-07-20 14:15               ` Oleg Nesterov
2007-07-24  2:07                 ` Jeremy Katz [this message]
2007-07-24 14:51                   ` Oleg Nesterov
2007-07-24 18:36                     ` Jeremy Katz
2007-07-24 20:43                       ` Oleg Nesterov
2007-07-24 21:19                         ` Jeremy Katz

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=Pine.LNX.4.63.0707231858420.9759@localhost.localdomain \
    --to=jeremy.katz@windriver.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    /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®