Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1292379

Re: pty: fix use after free/oops at pty_unix98_shutdown

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject Re: pty: fix use after free/oops at pty_unix98_shutdown
Date 2015-12-15 18:30 +0100
Message-ID <qG1Ae-7eq-11@gated-at.bofh.it> (permalink)
References <qFOtj-6Va-3@gated-at.bofh.it> <qG0ut-6y5-9@gated-at.bofh.it> <qG0NR-6Hh-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pty: fix use after free/oops at pty_unix98_shutdown "Herton R. Krzesinski" <herton@redhat.com> - 2015-12-15 04:30 +0100
  Re: pty: fix use after free/oops at pty_unix98_shutdown Peter Hurley <peter@hurleysoftware.com> - 2015-12-15 17:20 +0100
    Re: pty: fix use after free/oops at pty_unix98_shutdown "Herton R. Krzesinski" <herton@redhat.com> - 2015-12-15 17:40 +0100
      Re: pty: fix use after free/oops at pty_unix98_shutdown Peter Hurley <peter@hurleysoftware.com> - 2015-12-15 18:30 +0100
        Re: pty: fix use after free/oops at pty_unix98_shutdown "Herton R. Krzesinski" <herton@redhat.com> - 2015-12-15 18:50 +0100

csiph-web