Re: [PATCH v4 2/2] tty: add TIOCGPTPEER ioctl

From: Aleksa Sarai
Date: Fri Jun 09 2017 - 06:24:43 EST


When opening the slave end of a PTY, it is not possible for userspace to
safely ensure that /dev/pts/$num is actually a slave (in cases where the
mount namespace in which devpts was mounted is controlled by an
untrusted process). In addition, there are several unresolvable
race conditions if userspace were to attempt to detect attacks through
stat(2) and other similar methods [in addition it is not clear how
userspace could detect attacks involving FUSE].

Resolve this by providing an interface for userpace to safely open the
"peer" end of a PTY file descriptor by using the dentry cached by
devpts. Since it is not possible to have an open master PTY without
having its slave exposed in /dev/pts this interface is safe. This
interface currently does not provide a way to get the master pty (since
it is not clear whether such an interface is safe or even useful).

Cc: Christian Brauner <christian.brauner@xxxxxxxxxx>
Cc: Valentin Rothberg <vrothberg@xxxxxxxx>
Signed-off-by: Aleksa Sarai <asarai@xxxxxxx>

Is this going to be documented anywhere? Is there a man page update
that also goes along with this?

I will add one, I didn't know where the man-pages project is hosted / where
patches get pushed? What is the ML?

From the MAINTAINERS file:
MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
M: Michael Kerrisk <mtk.manpages@xxxxxxxxx>
W: http://www.kernel.org/doc/man-pages
L: linux-man@xxxxxxxxxxxxxxx
S: Maintained

Ah, should've looked there first!

Thanks Greg, I'll send it over the weekend.

--
Aleksa Sarai
Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html