All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] race condition with drivers/char/vt.c (bug in vt_ioctl.c)
Date: Mon, 22 Aug 2005 09:13:30 +0200	[thread overview]
Message-ID: <20050822071330.GA18456@elte.hu> (raw)
In-Reply-To: <1124508087.18408.79.camel@localhost.localdomain>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> I googled a little and found where this may have already happened in 
> the main line kernel:
> 
> http://seclists.org/lists/linux-kernel/2005/Aug/1603.html
> 
> So here's my proposal: 
> 
>   Instead of checking for tty->count == 1 in con_open, which we see is
> not reliable.  Just check for tty->driver_data == NULL.
> 
> This should work since it should always be NULL when we need to assign 
> it.  If we switch the events of the race, so that the init_dev went 
> first, the driver_data would not be NULL and would not need to be 
> allocated, because after init_dev tty->count would be greater than 1 
> (this is assuming the case that it is already allocated) and the 
> con_close would not deallocate it.  The tty_sem and console_sem and 
> order of events protect the tty->driver_data but not the tty->count.
> 
> Without the patch, I was able to get the system to BUG on bootup every 
> other time.  With the patch applied, I was able to bootup 6 out of 6 
> times without a single crash.

cool fix. I'm wondering, there's a whole lot of other 'tty->count == 1' 
checks in drivers/char/*.c, could some of those be racy too?

	Ingo

  reply	other threads:[~2005-08-22 22:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-20  3:21 [PATCH] race condition with drivers/char/vt.c (bug in vt_ioctl.c) Steven Rostedt
2005-08-22  7:13 ` Ingo Molnar [this message]
2005-08-22 13:50   ` Steven Rostedt
2005-08-23  0:08 ` Antonino A. Daplas
2005-08-23  0:19   ` Steven Rostedt

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=20050822071330.GA18456@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rostedt@goodmis.org \
    --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 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.