From: William Lee Irwin III <wli@holomorphy.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] generic-pidhash-2.5.36-D4, BK-curr
Date: Thu, 19 Sep 2002 03:59:40 -0700 [thread overview]
Message-ID: <20020919105940.GJ28202@holomorphy.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0209191116070.2377-100000@localhost.localdomain>
On Thu, Sep 19, 2002 at 11:25:11AM +0200, Ingo Molnar wrote:
> i'll add some debugging code to the old code to print out cases when
> p->tty == tty but p->session != tty->session and start up X, that should
> prove or disprove this theory, right?
> (i cant remember any other place where the code transformation was not
> identity, but will double-check this again.)
> William, you did the original transformation, was this optimization done
> intentionally?
> Ingo
Sorry, I was debugging some boot-time issues I ran into.
I did this intentionally. Basically, sys_setsid() does the right thing,
but tty_ioctl() does not. There is already some inconsistency
about how task->tty is locked, and I'd not yet come to a conclusion.
On second thought, I really hope I'm imagining things here:
For instance, tty_open() does the following while not holding the
tasklist_lock for writing:
if (IS_TTY_DEV(device)) {
if (!current->tty)
return -ENXIO;
device = current->tty->device;
So tiocsctty() appears to have the following race against tty_open():
A B
-----------------------------------------
tty->session > 0 if (!current->tty)
return -ENXIO; (test fails, don't return)
iterate tasklist, delay...
setting p->tty = NULL current->tty is set to NULL
(this looks like an attempt to obtain a unique
reference by blowing away everyone else's)
task_lock(current) device = current->tty->device
current->tty = tty OOPS
task_unlock(task)
tiocsctty() holds the BKL (from sys_ioctl() itself) and the
tasklist_lock for reading, but tty_open() seems to hold only some
vfs references. release_dev() does the same style of iteration, but
doesn't even hold the BKL, only the tasklist_lock for reading. And
is very ominously called by tty_open() itself.
Also, most other accesses to tty->session and/or tty->pgrp seem to
be protected by the BKL.
Bill
next prev parent reply other threads:[~2002-09-19 11:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44.0209182101150.27697-100000@localhost.localdomain>
2002-09-19 2:54 ` Ingo Molnar
2002-09-19 6:10 ` Linus Torvalds
2002-09-19 9:25 ` Ingo Molnar
2002-09-19 10:59 ` William Lee Irwin III [this message]
2002-09-19 15:12 ` Linus Torvalds
2002-09-19 15:21 ` Ingo Molnar
2002-09-19 16:35 ` Andries Brouwer
2002-09-19 16:43 ` Linus Torvalds
2002-09-19 18:54 ` Miquel van Smoorenburg
2002-09-19 19:10 ` Kai Henningsen
2002-09-19 20:32 ` Linus Torvalds
2002-09-19 22:29 ` Miquel van Smoorenburg
2002-09-19 19:38 ` [patch] generic-pidhash-2.5.36-J2, BK-curr Ingo Molnar
2002-09-19 20:21 ` Christoph Hellwig
2002-09-19 23:32 ` Dave Jones
2002-09-19 23:46 ` Ingo Molnar
2002-09-19 21:31 ` Linus Torvalds
2002-09-19 21:39 ` Ingo Molnar
2002-09-20 8:27 ` [patch] generic-pidhash-2.5.36-D4, BK-curr Oleg Drokin
2002-09-20 9:40 ` Ingo Molnar
2002-09-20 11:43 ` Oleg Drokin
2002-09-20 12:15 ` Russell King
2002-09-20 16:34 ` Ingo Molnar
2002-09-20 17:11 ` Andrew Morton
2002-09-20 13:03 Hanumanthu. H
2002-09-20 13:12 Hanumanthu. H
2002-09-20 13:09 ` Oleg Drokin
2002-09-20 16:47 ` Ingo Molnar
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=20020919105940.GJ28202@holomorphy.com \
--to=wli@holomorphy.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@transmeta.com \
/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