From: "Jon Smirl" <jonsmirl@gmail.com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: tty's use of file_list_lock and file_move
Date: Mon, 10 Jul 2006 14:09:03 -0400 [thread overview]
Message-ID: <9e4733910607101109w46915fbbl19bdd8664e1ca4d@mail.gmail.com> (raw)
In-Reply-To: <1152554708.27368.202.camel@localhost.localdomain>
On 7/10/06, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> Ar Llu, 2006-07-10 am 13:27 -0400, ysgrifennodd Jon Smirl:
> > > Its explained in the comment in do_SAK.
> >
> > This problem seems to be aggravated by reusing the tty_struct for that
> > tty. With the refcount patch it is now easy to disassociate an
> > existing tty (and the processes attached to it) from the array
> > tracking tty minors.
>
> The real problem is the rather deeper one - the lack of revoke(). Its
> possible to paper over that with SELinux but really we need revoke() and
> when you get revoke() you get the handle stuff cleaned up
>
> We hold file_list_lock because we have to find everyone using that tty
> and hang up their instance of it, then flip the file operations not
> because we need to protect against tty structs going away. It's needed
> in order to walk the file list and protects against the file list itself
> changing rather than the tty structs. It may well be possible to move
> that to a tty layer private lock with care, but it would need care to
> deal with VFS operations.
>
> We hold the ->files->file_lock because we have to walk other processes
> file tables in a safe fashion in SAK. That one is fairly clear.
What if do_SAK did something like this?
copy the tty struct to new_tty
NULL out the file list in new_tty
insert new_tty into the array tracking tty minors so that open will
find the new one
in old_tty stub out all of it's routines that do read/write/etc
Now start a kernel thread doing the HUP/INT/KILL sequence, it has a
reference to old_tty so it can find everything.
When everything is clean, delete old_tty
The processes and file handles attached to old_tty won't be able to do
anything, all of their IO calls have been stubbed out. The file list
can't be changed since there there is no way to get to it anymore.
When init respawns it picks up new_tty which is guaranteed clean of
processes and open handles because it was just created.
--
Jon Smirl
jonsmirl@gmail.com
next prev parent reply other threads:[~2006-07-10 18:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-10 15:10 Jon Smirl
2006-07-10 17:33 ` Alan Cox
2006-07-10 17:27 ` Jon Smirl
2006-07-10 18:05 ` Alan Cox
2006-07-10 18:09 ` Jon Smirl [this message]
2006-07-10 23:18 ` Alan Cox
2006-07-10 22:35 ` Jon Smirl
2006-07-10 23:15 ` Alan Cox
2006-07-10 23:04 ` Jon Smirl
2006-07-10 23:49 ` Jon Smirl
2006-07-11 1:29 ` Theodore Tso
2006-07-11 2:16 ` Jon Smirl
2006-07-11 10:12 ` Alan Cox
2006-07-11 12:28 ` Jon Smirl
2006-07-11 13:15 ` Paulo Marques
2006-07-11 13:42 ` Jon Smirl
2006-07-11 3:33 ` Jon Smirl
2006-07-11 19:52 ` Russell King
2006-07-11 19:44 ` Russell King
2006-07-11 22:08 ` Jon Smirl
2006-07-11 22:37 ` Alan Cox
2006-07-11 23:28 ` Paul Fulghum
2006-07-12 0:00 ` Jon Smirl
2006-07-11 23:50 ` Jon Smirl
2006-07-12 3:55 ` Jon Smirl
2006-07-12 11:37 ` Alan Cox
2006-07-10 23:39 ` Theodore Tso
2006-07-11 0:25 ` Jon Smirl
2006-07-12 6:27 ` Pekka Enberg
2006-07-12 11:19 ` Alan Cox
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=9e4733910607101109w46915fbbl19bdd8664e1ca4d@mail.gmail.com \
--to=jonsmirl@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.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 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®