TIOCSTI: always enable for CAP_SYS_ADMIN

83efeeeb3d ("tty: Allow TIOCSTI to be disabled") broke BRLTTY's
ability to simulate keypresses on the console, thus effectively breaking
braille keyboards of blind users.

This restores the TIOCSTI feature for CAP_SYS_ADMIN processes, which
BRLTTY is, thus fixing braille keyboards without re-opening the security
issue.

Signed-off-by: Samuel Thibault <[email protected]>
Acked-by: Kees Cook <[email protected]>
Fixes: 83efeeeb3d ("tty: Allow TIOCSTI to be disabled")
Cc: [email protected]
Reported-by: Nicolas Pitre <[email protected]>
Link: https://lore.kernel.org/r/20230710002645.v565c7xq5iddruse@begin
Acked-by: Jiri Slaby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Samuel Thibault
2023-07-20 19:21:16 +02:00
committed by Greg Kroah-Hartman
parent fdf0eaf114
commit 690c8b804a
+1 -1
View File
@@ -2285,7 +2285,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
char ch, mbz = 0;
struct tty_ldisc *ld;
if (!tty_legacy_tiocsti)
if (!tty_legacy_tiocsti && !capable(CAP_SYS_ADMIN))
return -EIO;
if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))