Re: [PATCH v2] tty: Permit some TIOCL_SETSEL modes without CAP_SYS_ADMIN

From: Kees Cook
Date: Fri Jan 10 2025 - 11:51:23 EST


On Fri, Jan 10, 2025 at 02:21:22PM +0000, Günther Noack wrote:
> With this, processes without CAP_SYS_ADMIN are able to use TIOCLINUX with
> subcode TIOCL_SETSEL, in the selection modes TIOCL_SETPOINTER,
> TIOCL_SELCLEAR and TIOCL_SELMOUSEREPORT.
>
> TIOCL_SETSEL was previously changed to require CAP_SYS_ADMIN, as this IOCTL
> let callers change the selection buffer and could be used to simulate
> keypresses. These three TIOCL_SETSEL selection modes, however, are safe to
> use, as they do not modify the selection buffer.
>
> This fixes a mouse support regression that affected Emacs (invisible mouse
> cursor).
>
> Cc: stable@xxxxxxxxxxxxxxx
> Link: https://lore.kernel.org/r/ee3ec63269b43b34e1c90dd8c9743bf8@xxxxxxxxxx
> Fixes: 8d1b43f6a6df ("tty: Restrict access to TIOCLINUX' copy-and-paste subcommands")
> Signed-off-by: Günther Noack <gnoack@xxxxxxxxxx>

Reviewed-by: Kees Cook <kees@xxxxxxxxxx>

--
Kees Cook