Skip to content

Commit e4a62da

Browse files
committed
README: Document glibc grantpt group bug 19347
I bumped into this on my glibc 2.21 system while testing process.terminal = true in a user namespace that did not create a new mount namespace.
1 parent e4b616d commit e4a62da

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,22 +412,31 @@ the user's control-C into [`SIGINT`][signal.7] for the container.
412412
Containers that do not [pivot root](#mount-namespace) or who otherwise
413413
keep access to the host [ptmx][pts.4] can create such a pseudoterminal
414414
by calling opening the [ptmx][pts.4] (e.g. with
415-
[`posix_openpt`][posix_openpt.3]).
415+
[`posix_openpt`][posix_openpt.3p]).
416416

417417
Containers that are pivoting to a new root and mounting their
418418
[devpts][] with [newinstance][mount.8] will want to ensure that the
419419
pseudoterminal is created using a devpts instance that will be
420420
accessible after the pivot, and there are [a number of issues to
421421
consider][devpts].
422422

423-
* **`terminal`** (optional, boolean) if true, the process will [open
424-
its local `/dev/ptmx`][pts.4] (e.g. with
425-
[`posix_openpt`][posix_openpt.3]), [`dup`][dup.2] the pseudoterminal
426-
slave over its standard streams, and send the pseudoterminal master
427-
back to the host process. The host process will continually copy
428-
its [standard input][stdin.3] to that pseudoterminal master and the
423+
* **`terminal`** (optional, boolean) if true, the process will
424+
[open its local `/dev/ptmx`][pts.4] (e.g. with
425+
[`posix_openpt`][posix_openpt.3p]), grant access to the slave with
426+
[`grantpt`][grantpt.3p], [`dup`][dup.2] the pseudoterminal slave over
427+
its standard streams, and send the pseudoterminal master back to the
428+
host process. The host process will continually copy its
429+
[standard input][stdin.3] to that pseudoterminal master and the
429430
pseudoterminal master to its [standard output][stdin.3].
430431

432+
Before [77356912][glibc-77356912] (included in version 2.23, released
433+
2016-02-19), [glibc][]'s [`grantpt`][grantpt.3] was more agressive
434+
about changing the pseudterminal slave's group, which [could fail for
435+
unprivileged users][glibc-bug-19347]. Unprivileged users linking
436+
older versions of glibc can work around the old behavior by ensuring
437+
`tty` is not defined in the `/etc/group` visible from the container's
438+
mount namespace.
439+
431440
##### Example
432441

433442
```json
@@ -777,8 +786,10 @@ be distributed under the GPLv3+.
777786
[bash-process-substitution]: https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html
778787
[BusyBox]: http://www.busybox.net/
779788
[GCC]: http://gcc.gnu.org/
780-
[glibc-license]: https://sourceware.org/git/?p=glibc.git;a=blob;f=COPYING.LIB;hb=glibc-2.22
781789
[glibc]: https://www.gnu.org/software/libc/
790+
[glibc-license]: https://sourceware.org/git/?p=glibc.git;a=blob;f=COPYING.LIB;hb=glibc-2.22
791+
[glibc-77356912]: https://sourceware.org/git/?p=glibc.git;a=commit;h=77356912e83601fd0240d22fe4d960348b82b5c3
792+
[glibc-bug-19347]: https://sourceware.org/bugzilla/show_bug.cgi?id=19347
782793
[indent]: https://www.gnu.org/software/indent/
783794
[Jansson]: http://www.digip.org/jansson/
784795
[jansson-license]: https://github.com/akheron/jansson/blob/v2.7/LICENSE
@@ -825,7 +836,8 @@ be distributed under the GPLv3+.
825836
[environ.3p]: https://www.kernel.org/pub/linux/docs/man-pages/man-pages-posix/
826837
[exec.3]: http://man7.org/linux/man-pages/man3/exec.3.html
827838
[getcwd.3]: http://man7.org/linux/man-pages/man3/getcwd.3.html
828-
[posix_openpt.3]: http://man7.org/linux/man-pages/man3/posix_openpt.3.html
839+
[grantpt.3p]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/grantpt.html
840+
[posix_openpt.3p]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_openpt.html
829841
[stdin.3]: http://man7.org/linux/man-pages/man3/stdin.3.html
830842
[pts.4]: http://man7.org/linux/man-pages/man4/pty.4.html
831843
[filesystems.5]: http://man7.org/linux/man-pages/man5/filesystems.5.html

0 commit comments

Comments
 (0)