From: Ingo Molnar <mingo@elte.hu>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Jeremy Katz <jeremy.katz@windriver.com>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
Oleg Nesterov <oleg@tv-sign.ru>, Stable Team <stable@kernel.org>
Subject: Re: [PATCH] posix-timer: fix deletion race
Date: Tue, 17 Jul 2007 11:57:08 +0200 [thread overview]
Message-ID: <20070717095707.GB6411@elte.hu> (raw)
In-Reply-To: <1184662429.12353.426.camel@chaos>
* Thomas Gleixner <tglx@linutronix.de> wrote:
> Jeremy Katz experienced a posix-timer related bug on 2.6.14. This is
> caused by a subtle race, which is there since the original posix timer
> commit and persists until today.
>
> timer_delete does:
> lock_timer();
> timer->it_process = NULL;
> unlock_timer();
> release_posix_timer();
>
> timer->it_process is checked in lock_timer() to prevent access to a
> timer, which is on the way to be deleted, but the check happens after
> idr_lock is dropped. This allows release_posix_timer() to delete the
> timer before the lock code can check the timer:
>
> CPU 0 CPU 1
> lock_timer();
> timer->it_process = NULL;
> unlock_timer();
> lock_timer()
> spin_lock(idr_lock);
> timer = idr_find();
> spin_lock(timer->lock);
> spin_unlock(idr_lock);
> release_posix_timer();
> spin_lock(idr_lock);
> idr_remove(timer);
> spin_unlock(idr_lock);
> free_timer(timer);
> if (timer->......)
>
> Change the locking to prevent this.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
nice one! The race looks pretty narrow - Jeremy, does your Xens have
hyperthreading? (or are there any heavy SMI sources perhaps that could
open up this race.) If not then there might be some other bug lurking in
there as well.
Acked-by: Ingo Molnar <mingo@elte.hu>
Ingo
next prev parent reply other threads:[~2007-07-17 9:57 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 [this message]
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
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=20070717095707.GB6411@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=jeremy.katz@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--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