Go to file
Peter Korsgaard b9026e83f9 fs/cpio/init: unbreak ttyname_r() on glibc after dropping /dev/console exec
Commit 98a6f1fc02 (fs/cpio: make initramfs init script survive 'console='
kernel argument) dropped the explicit /dev/console execs for fd 0,1,2, as
they fail when booted with console= and aren't really needed as the kernel
will setup fd 0,1,2 from /dev/console before executing the initramfs anyway.

Not doing this unfortunately confuses glibc's ttyname_r(3) implementation
(used by E.G.  busybox/coreutils 'tty'), causing it to fail with ENOENT as
it does a fstat on fd 0 and tries to match up st_ino / st_dev against the
entries in /dev (since glibc 2.26):

 commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
 Author: Christian Brauner <christian.brauner@canonical.com>
 Date:   Fri Jan 27 15:59:59 2017 +0100

    linux ttyname and ttyname_r: do not return wrong results

    If a link (say /proc/self/fd/0) pointing to a device, say /dev/pts/2, in a
    parent mount namespace is passed to ttyname, and a /dev/pts/2 exists (in a
    different devpts) in the current namespace, then it returns /dev/pts/2.
    But /dev/pts/2 is NOT the current tty, it is a different file and device.

    Detect this case and return ENODEV.  Userspace can choose to take this as a hint
    that the fd points to a tty device but to act on the fd rather than the link.

    Signed-off-by: Serge Hallyn <serge@hallyn.com>
    Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>

The reason it fails is that we manually mount devtmpfs on /dev in /init, so
the /dev/console used by the kernel (in rootfs) is not the same file as
/dev/console at runtime (in devtmpfs).

Notice: Once logged in, tty does work correctly.  Presumably login reopens
stdin/stdout/stderr.

To fix this, re-add the exec of /dev/console for fd 0,1,2, but only do so if
possible.  Because of the above mentioned shell behaviour (specified by
POSIX [0]), perform this check in a subshell.

[0] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_20_01

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-08-29 16:32:33 +02:00
arch arch/Config.in: add BR2_ARCH_NEEDS_GCC_AT_LEAST_10 2020-06-24 21:57:43 +02:00
board configs/arcturus_ucls1012a: bump kernel to 4.14.140 and u-boot version to 2019.10 2020-08-12 16:41:06 +02:00
boot boot/optee-os: depend on host-python3 2020-08-09 00:13:41 +02:00
configs configs/qemu_*: bump kernel version to 5.4.58 2020-08-14 23:01:49 +02:00
docs Update for 2020.08-rc3 2020-08-28 23:10:20 +02:00
fs fs/cpio/init: unbreak ttyname_r() on glibc after dropping /dev/console exec 2020-08-29 16:32:33 +02:00
linux {linux, linux-headers}: bump 4.{4, 9, 14, 19}.x / 5.{4, 7}.x series 2020-08-28 22:35:15 +02:00
package package/lxc: bump to version 4.0.4 2020-08-29 16:03:15 +02:00
support support/scripts/pkg-stats: drop erroneous "break" in CVE.affects() 2020-08-27 18:04:33 +02:00
system system: replace nogroup with nobody 2020-07-18 14:18:33 +02:00
toolchain toolchain/toolchain-external/toolchain-external-codesourcery-amd64: remove package 2020-08-24 23:35:19 +02:00
utils utils/scanpypi: use raw strings in re.compile/re.sub 2020-08-14 21:56:17 +02:00
.defconfig
.flake8
.gitignore
.gitlab-ci.yml gitlab-ci: update the image version 2020-08-15 09:47:00 +02:00
CHANGES Update for 2020.08-rc3 2020-08-28 23:10:20 +02:00
Config.in Config.in: update BR2_OPTIMIZE_FAST prompt and help text 2020-07-18 16:05:01 +02:00
Config.in.legacy toolchain/toolchain-external/toolchain-external-codesourcery-amd64: remove package 2020-08-24 23:35:19 +02:00
COPYING
DEVELOPERS DEVELOPERS: add myself as contact for linuxptp+ipmitool 2020-08-27 23:12:25 +02:00
Makefile Makefile: hide commands that build the package file lists at end of build 2020-08-29 14:33:21 +02:00
Makefile.legacy
README

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on Freenode IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches