mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Américo Wang" <xiyou.wangcong@gmail.com>,
	"Tetsuo Handa" <penguin-kernel@I-love.SAKURA.ne.jp>,
	gregkh@suse.de, taviso@google.com, viro@ZenIV.linux.org.uk,
	linux-kernel@vger.kernel.org, ebiederm@xmission.com,
	alan@lxorguk.ukuu.org.uk, jdike@addtoit.com, jln@google.com,
	mpm@selenic.com
Subject: Re: [2.6.33-rc5] tty: possible irq lock inversion dependency in tty_fasync
Date: Mon, 8 Feb 2010 00:06:57 +0800	[thread overview]
Message-ID: <20100207160657.GA17447@hack> (raw)
In-Reply-To: <alpine.LFD.2.00.1002062246390.3829@localhost.localdomain>

On Sat, Feb 06, 2010 at 10:59:56PM -0800, Linus Torvalds wrote:
>
>
>On Sun, 7 Feb 2010, Américo Wang wrote:
>> 
>> We already fixed this, a better fix:
>
>No we didn't.
>
>> http://lkml.org/lkml/2010/1/26/338
>> 
>> I sent a same fix with Greg's.
>
>We already did that. You didn't read Tetsuo's email carefully.
>
>Let's quote the important parts:
>
>  "is not yet fixed as of 2.6.33-rc7."
>
>and also the _second_ lockdep complaint he quotes, which starts out with
>
>  [   81.651199] =========================================================
>  [   81.651199] [ INFO: possible irq lock inversion dependency detected ]
>  [   81.651199] 2.6.33-rc7 #11
>  [   81.651199] ---------------------------------------------------------
>
>(note the -rc7 there).
>


Ah, I was just mislead by the subject... sigh


>The problem? Look at f_getown: it does
>
>	read_lock(&filp->f_owner.lock);
>
>ie it holds f_owner without interrupts disabled. Now an interrupt comes 
>in, and takes 'siglock' because it ends up sending a signal (timer, SIGIO, 
>whatever). So you have a f_owner -> siglock ordering.
>
>But we _also_ have a siglock -> ctrl_lock -> f_owner ordering, in that 
>problematic tty_fasync() thing. So we have a ABBA deadlock situation.
>
>Yes, it's hard (practically impossible) to trigger, because you have to 
>get an interrupt just at the right point with all the right processes, but 
>lockdep seems to be entirely correct. 
>
>So it is simply _wrong_ to take f_owner while we hold ctrl_lock.
>
>Which is why I suggest just reverting both the original problematic commit 
>_and_ the commit you point to, and just fix the race with that pid_get/put 
>pair instead. As per my patch.
>

Good analysis, this seems better for me too.

Thank you!

  reply	other threads:[~2010-02-07 16:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-07  5:52 Tetsuo Handa
2010-02-07  6:31 ` Linus Torvalds
2010-02-07  6:46   ` Linus Torvalds
2010-02-07  7:27     ` Greg KH
2010-02-07  8:12       ` [2.6.33-rc5] tty: possible irq lock inversion dependency intty_fasync Tetsuo Handa
2010-02-07  6:46   ` [2.6.33-rc5] tty: possible irq lock inversion dependency in tty_fasync Américo Wang
2010-02-07  6:59     ` Linus Torvalds
2010-02-07 16:06       ` Américo Wang [this message]
2010-02-07  7:00     ` Eric W. Biederman

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=20100207160657.GA17447@hack \
    --to=xiyou.wangcong@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=jdike@addtoit.com \
    --cc=jln@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=taviso@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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

Powered by JetHome