All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ioctl_tty.2: add TIOCGPTPEER documentation
@ 2017-06-09 17:01 ` Aleksa Sarai
  0 siblings, 0 replies; 28+ messages in thread
From: Aleksa Sarai @ 2017-06-09 17:01 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	Christian Brauner, Valentin Rothberg, Jiri Slaby, Aleksa Sarai,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

The feature this patch references has currently only been accepted into
tty-testing, but Greg told me to kick this down to man-pages. As a
result, I can't reference upstream commit id's because the code isn't in
Linus' tree yet -- should I resend this once it lands in tty-next or
Linus' tree?

Also obviously the release version is a bit of a lie.

8<-----------------------------------------------------------------------

This is an ioctl(2) recently added by myself, to allow for container
runtimes and other programs that interact with (potentially hostile)
Linux namespaces to safely create {master,slave} pseudoterminal pairs
without needing to open potentially unsafe /dev/pts/... filenames that
may be malicious mountpoints or similar in an untrusted namespace
(avoiding the endless issues with ptsname(3) and similar approaches).

Cc: <containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Signed-off-by: Aleksa Sarai <asarai-l3A5Bk7waGM@public.gmane.org>
---
 man2/ioctl_tty.2 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index d280beacf..61e147d99 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -380,6 +380,21 @@ Place the current lock state of the pseudoterminal slave device
 in the location pointed to by
 .IR argp
 (since Linux 3.8).
+.TP
+.BI "TIOCGPTPEER	int " flags
+Opens and returns a new file handle to the pseudoterminal slave
+device with the given
+.BR open (2)-style
+.IR flags ,
+regardless of whether the path is accessible through the calling process's
+mount namespaces.
+
+Security-conscious programs interacting with namespaces may wish to use this
+over
+.BR open (2)
+with the path provided by
+.BR ptsname (3),
+and similar library methods that have insecure APIs (since Linux 4.13).
 .PP
 The BSD ioctls
 .BR TIOCSTOP ,
-- 
2.13.1

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 28+ messages in thread
* [PATCH] ioctl_tty.2: add TIOCGPTPEER documentation
@ 2017-06-09 17:01 Aleksa Sarai
  0 siblings, 0 replies; 28+ messages in thread
From: Aleksa Sarai @ 2017-06-09 17:01 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Valentin Rothberg,
	Greg Kroah-Hartman,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jiri Slaby,
	Christian Brauner

The feature this patch references has currently only been accepted into
tty-testing, but Greg told me to kick this down to man-pages. As a
result, I can't reference upstream commit id's because the code isn't in
Linus' tree yet -- should I resend this once it lands in tty-next or
Linus' tree?

Also obviously the release version is a bit of a lie.

8<-----------------------------------------------------------------------

This is an ioctl(2) recently added by myself, to allow for container
runtimes and other programs that interact with (potentially hostile)
Linux namespaces to safely create {master,slave} pseudoterminal pairs
without needing to open potentially unsafe /dev/pts/... filenames that
may be malicious mountpoints or similar in an untrusted namespace
(avoiding the endless issues with ptsname(3) and similar approaches).

Cc: <containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Signed-off-by: Aleksa Sarai <asarai-l3A5Bk7waGM@public.gmane.org>
---
 man2/ioctl_tty.2 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index d280beacf..61e147d99 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -380,6 +380,21 @@ Place the current lock state of the pseudoterminal slave device
 in the location pointed to by
 .IR argp
 (since Linux 3.8).
+.TP
+.BI "TIOCGPTPEER	int " flags
+Opens and returns a new file handle to the pseudoterminal slave
+device with the given
+.BR open (2)-style
+.IR flags ,
+regardless of whether the path is accessible through the calling process's
+mount namespaces.
+
+Security-conscious programs interacting with namespaces may wish to use this
+over
+.BR open (2)
+with the path provided by
+.BR ptsname (3),
+and similar library methods that have insecure APIs (since Linux 4.13).
 .PP
 The BSD ioctls
 .BR TIOCSTOP ,
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2017-11-20 17:06 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 17:01 [PATCH] ioctl_tty.2: add TIOCGPTPEER documentation Aleksa Sarai
2017-06-09 17:01 ` Aleksa Sarai
     [not found] ` <20170609170147.32311-1-asarai-l3A5Bk7waGM@public.gmane.org>
2017-06-09 18:10   ` Greg Kroah-Hartman
2017-06-09 18:10     ` Greg Kroah-Hartman
2017-06-09 18:10   ` Greg Kroah-Hartman
2017-08-15 19:27   ` Michael Kerrisk (man-pages)
2017-08-15 19:27     ` Michael Kerrisk (man-pages)
     [not found]     ` <11706e49-8271-ed8c-3747-19b3e8f2850d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-16  4:43       ` Aleksa Sarai
2017-08-16  4:43         ` Aleksa Sarai
2017-08-16 16:43       ` Eric W. Biederman
2017-08-16 16:43         ` Eric W. Biederman
     [not found]         ` <878tijwjic.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2017-08-16 16:54           ` Aleksa Sarai
2017-08-16 16:54           ` Aleksa Sarai
2017-08-16 16:54             ` Aleksa Sarai
     [not found]             ` <a7175aad-645c-8f86-d7cf-51f24f0bc281-l3A5Bk7waGM@public.gmane.org>
2017-08-16 17:14               ` Eric W. Biederman
2017-08-16 17:14                 ` Eric W. Biederman
     [not found]                 ` <87ziaztoxu.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2017-11-20 10:20                   ` Michael Kerrisk (man-pages)
2017-11-20 10:20                   ` Michael Kerrisk (man-pages)
2017-11-20 10:20                     ` Michael Kerrisk (man-pages)
     [not found]                     ` <c702b5c6-0098-4a61-f51c-c28ed085534f-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-20 12:15                       ` Christian Brauner
2017-11-20 12:15                         ` Christian Brauner
2017-11-20 12:15                       ` Christian Brauner
2017-11-20 17:06                       ` Eric W. Biederman
2017-11-20 17:06                       ` Eric W. Biederman
2017-11-20 17:06                         ` Eric W. Biederman
2017-08-16 17:14               ` Eric W. Biederman
2017-08-15 19:27   ` Michael Kerrisk (man-pages)
  -- strict thread matches above, loose matches on Subject: below --
2017-06-09 17:01 Aleksa Sarai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.