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


Groups > linux.kernel > #1311034

Re: [PATCH 2/2 v2] pty: make sure super_block is still valid in final /dev/tty close

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2 v2] pty: make sure super_block is still valid in final /dev/tty close
Date 2016-01-16 22:20 +0100
Message-ID <qRGqm-1tO-17@gated-at.bofh.it> (permalink)
References <qPLkv-3rc-29@gated-at.bofh.it> <qPLkw-3rc-41@gated-at.bofh.it> <qQxSb-37P-25@gated-at.bofh.it> <qQWdQ-3jT-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/14/2016 11:56 AM, Herton R. Krzesinski wrote:
> Considering current pty code and multiple devpts instances, it's possible
> to umount a devpts file system while a program still has /dev/tty opened
> pointing to a previosuly closed pty pair in that instance. In the case all
> ptmx and pts/N files are closed, umount can be done. If the program closes
> /dev/tty after umount is done, devpts_kill_index will use now an invalid
> super_block, which was already destroyed in the umount operation after
> running ->kill_sb. This is another "use after free" type of issue, but now
> related to the allocated super_block instance.
> 
> To avoid the problem (warning at ida_remove and potential crashes) for
> this specific case, I added two functions in devpts which grabs additional
> references to the super_block, which pty code now uses so it makes sure
> the super block structure is still valid until pty shutdown is done.
> I also moved the additional inode references to the same functions, which
> also covered similar case with inode being freed before /dev/tty final
> close/shutdown.

Thanks again.

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>

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


Thread

Re: [PATCH 2/2 v2] pty: make sure super_block is still valid in final  /dev/tty close Peter Hurley <peter@hurleysoftware.com> - 2016-01-16 22:20 +0100

csiph-web