mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: "Herton R. Krzesinski" <herton@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>
Subject: Re: pty: fix use after free/oops at pty_unix98_shutdown
Date: Tue, 15 Dec 2015 09:28:28 -0800	[thread overview]
Message-ID: <56704DBC.4080503@hurleysoftware.com> (raw)
In-Reply-To: <20151215163604.GA20334@dhcppc10.redhat.com>

On 12/15/2015 08:36 AM, Herton R. Krzesinski wrote:
> On Tue, Dec 15, 2015 at 08:17:56AM -0800, Peter Hurley wrote:
>>> I also expect in a rare case where all ptmx references are gone/closed, this also
>>> could happen on final close when the master tty is given to pty_unix98_shutdown.
>>
>> This logic I'm not following. If the pty master is being released, then the inode
>> is valid for the release() operation in-progress.
> 
> Hi Peter,
> 
> yes, you're right if you are eg. closing the /dev/ptmx or /dev/pts/ptmx file
> previously opened. But I thought and refer above to the case where for example
> you are closing /dev/tty and that's the final close and there is no other
> process in the system with the /dev/{,*/}ptmx opened, the inode which referenced
> the previously opened ptmx could be gone. It would be rare though since in a
> running system any logged in user eg. through ssh or with a terminal open in X
> will have at least a ptmx device opened.

/dev/tty can never be an alias for /dev/ptmx in Linux: a master pty cannot be
a controlling terminal. So if the master pty is being released it will always be
with the /dev/ptmx inode.

Regards,
Peter Hurley

PS - for the purpose of this discussion, /dev/pts/ptmx is equivalent.

  reply	other threads:[~2015-12-15 17:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15  3:29 Herton R. Krzesinski
2015-12-15  3:29 ` [PATCH] pty: fix use after free of tty->driver_data Herton R. Krzesinski
2015-12-15 17:36   ` Peter Hurley
2015-12-15 18:05     ` Herton R. Krzesinski
2015-12-15 19:23       ` Herton R. Krzesinski
2015-12-15 19:52         ` Peter Hurley
2015-12-15 20:34           ` Herton R. Krzesinski
2015-12-15 20:36             ` Peter Hurley
2015-12-29 17:58       ` Herton R. Krzesinski
2016-01-07 22:36         ` Peter Hurley
2016-01-11 14:11           ` Herton R. Krzesinski
2015-12-15 16:17 ` pty: fix use after free/oops at pty_unix98_shutdown Peter Hurley
2015-12-15 16:36   ` Herton R. Krzesinski
2015-12-15 17:28     ` Peter Hurley [this message]
2015-12-15 17:41       ` Herton R. Krzesinski

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=56704DBC.4080503@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herton@redhat.com \
    --cc=jslaby@suse.com \
    --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

Powered by JetHome