public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix to allow more correct isatty()
@ 2024-11-21 11:12 Gil Pedersen
  2024-11-21 11:12 ` [PATCH 1/1] tty: respond to TIOCGWINSZ when hung Gil Pedersen
  2024-11-22 23:54 ` [PATCH 0/1] Fix to allow more correct isatty() nerdopolis
  0 siblings, 2 replies; 6+ messages in thread
From: Gil Pedersen @ 2024-11-21 11:12 UTC (permalink / raw)
  To: linux-kernel, linux-serial; +Cc: Greg Kroah-Hartman, Jiri Slaby, Gil Pedersen

This patch comes from an issue discovered in systemd, where it can fail to
restore a text TTY session after a GUI session is stopped when compiled
with musl libc.

The specific systemd integration issue is currently resolved in the musl
master branch by closer aligning the implementation with glibc, but the
underlying isatty() implementation is still flawed since it can return 0
(false) for something that is definitely a TTY. Essentially both musl
and glibc give up correctly handling this case on Linux due to
inadequate/buggy kernel APIs.

Thus I am proposing this patch as a solution to fix the kernel APIs. An
alternative fix could be to add a new IOCTL to specifically handle this,
but that seems overkill.

Link: https://github.com/systemd/systemd/pull/34039
Link: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/70711
Link: https://www.openwall.com/lists/musl/2024/08/20/2
Link: https://git.musl-libc.org/cgit/musl/commit/src/unistd/isatty.c?id=c94a0c16f08894ce3be6dafb0fe80baa77a6ff2a
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=32103

Gil Pedersen (1):
  tty: respond to TIOCGWINSZ when hung

 drivers/tty/tty_io.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

-- 
2.45.2


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

end of thread, other threads:[~2025-01-10 14:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 11:12 [PATCH 0/1] Fix to allow more correct isatty() Gil Pedersen
2024-11-21 11:12 ` [PATCH 1/1] tty: respond to TIOCGWINSZ when hung Gil Pedersen
2024-12-23 17:56   ` Greg Kroah-Hartman
2025-01-07 11:44     ` Gil Pedersen
2025-01-10 14:52       ` Greg Kroah-Hartman
2024-11-22 23:54 ` [PATCH 0/1] Fix to allow more correct isatty() nerdopolis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox