git-ctty
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sun, 3 Dec 2023 13:23:52 +0000 (14:23 +0100)
committerAurelien Jarno <aurel32@debian.org>
Sun, 3 Dec 2023 13:23:52 +0000 (14:23 +0100)
commit7fd0a5a4e206aa91fa32d188e222812fc8298135
treea1736f5fe50e249556488b27607cc4c17be44001
parentc30888df91f15c1b142f8eedcf8b7a7478d911d2
git-ctty

commit 346b6eab3c14ead0b716d53e2235464b822f48f2
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Sat Apr 15 22:08:56 2023 +0300

    hurd: Run init_pids () before init_dtable ()

    Much as the comment says, things on _hurd_subinit assume that _hurd_pid
    is already initialized by the time _hurd_subinit is run, so
    _hurd_proc_subinit has to run before it. Specifically, init_dtable ()
    calls _hurd_port2fd (), which uses _hurd_pid and _hurd_pgrp to set up
    ctty handling. With _hurd_subinit running before _hurd_proc_subinit,
    ctty setup was broken:

      13<--33(pid1255)->term_getctty () = 0    4<--39(pid1255)
    task16(pid1255)->mach_port_deallocate (pn{ 10}) = 0
      13<--33(pid1255)->term_open_ctty (0 0) = 0x40000016 (Invalid argument)

    Fix this by running the _hurd_proc_subinit hook in the correct place --
    just after _hurd_portarray is set up (so the proc server port is
    available in its usual place) and just before running _hurd_subinit.

    Fixes 1ccbb9258eed0f667edf459a28ba23a805549b36
    ("hurd: Notify the proc server later during initialization").

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-ctty.diff
hurd/hurdinit.c