From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74220: invisible cursor Date: Thu, 28 Nov 2024 13:45:49 -0800 Message-ID: References: <87ldxwmppm.fsf@gmail.com> <86o72ssfm4.fsf@gnu.org> <87bjyscp5e.fsf@gmx.net> <2b5006ac22491fd8c509120ad653117d@finder.org> <8b70d54cd579f33d1e698a0f8927dc4f@finder.org> <865xo7cdpv.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13222"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74220@debbugs.gnu.org, gerd.moellmann@gmail.com, ampinkas@gmail.com, stephen.berman@gmx.net, rpluim@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 28 22:46:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tGmL6-0003IR-7E for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Nov 2024 22:46:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGmKq-0000oV-E7; Thu, 28 Nov 2024 16:46:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGmKp-0000oK-6c for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 16:46:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGmKo-0004ce-Ne for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 16:46:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:MIME-Version:To:Subject; bh=JU8cV5NbeAArfZ6pFPExe8Dolr4PXfMIkzIIEjmOoxk=; b=JRbtmzDlOJGZSHVVwIJj+BoHUXum8pBI0RKRPCf7w/ns86ZeHhnwV2GF6rEIO7JCNBcw2je7ynbDogU8wBr6A9EqK6VOfApyhgYtwkWqmiBvvGYkIzd0LtJYZlRrLe2gdtvuErAtWE0yrKuypNkI9j79WoM32JAddnLoQWd6GT0Gbfnir8zgb/b29ftdJdrTfdcUSFsbR1sVpF07js+RdHqsXkdrCjY0CvdtPiYFpFvPbH0S5trIMuc2J/0NuYIjDvTy8psztr3hiP/dV5FZO2V249mKHCs+AtXTEAxyYEZ+oP1T75nUIxoozNLbaFrifXGns9W/XetK5F/uICCiYA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tGmKo-00033T-FK for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 16:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jared Finder Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Nov 2024 21:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74220 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, gerd.moellmann@gmail.com, 74220@debbugs.gnu.org, ampinkas@gmail.com, stephen.berman@gmx.net, rpluim@gmail.com Original-Received: via spool by 74220-submit@debbugs.gnu.org id=B74220.173283035411708 (code B ref 74220); Thu, 28 Nov 2024 21:46:02 +0000 Original-Received: (at 74220) by debbugs.gnu.org; 28 Nov 2024 21:45:54 +0000 Original-Received: from localhost ([127.0.0.1]:40017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGmKg-00032m-1M for submit@debbugs.gnu.org; Thu, 28 Nov 2024 16:45:54 -0500 Original-Received: from greenhill.hpalace.com ([192.155.80.58]:50980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGmKd-00032Z-Jc for 74220@debbugs.gnu.org; Thu, 28 Nov 2024 16:45:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1732830349; bh=UeLodj1vWQEdkhfORk2k79YnKyD/QGNaDySiYjPMlLA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L8488hAuup0pvSDYNIShUt0XQG5QLPafmFJnZD0kMPIq4RxfKryVm8zvtS3nf00i7 jN6M46rpf5SXx9fbjeCYxgRTB9fPEtxRfDyU2j5UkEf4HVextlki+sIZhtdDXNXkER POdOYxs9PIIcEDDagIKqg5GwMC1NX+/XS6ejyKtCl9AGXdAzMw2D/31772hkRuc0FI /FOje7tE9UT3+VLoTHu33JA/oaRisNNzE/mQQEpfwPOlOXydl1Fq7ikSiNiE7E2dV2 5TbYu/OkdYnKNAS5eAj/wlas2GsohPnd9MRvadrOm+Hfm/QnE1PNwdG+hVyr5L1oTS 7VPeoFXzAhGIg== Original-Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id 33FAB138A; Thu, 28 Nov 2024 21:45:49 +0000 (UTC) In-Reply-To: <865xo7cdpv.fsf@gnu.org> X-Sender: jared@finder.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296070 Archived-At: On 2024-11-28 12:20, Eli Zaretskii wrote: >> Date: Thu, 28 Nov 2024 10:21:53 -0800 >> From: Jared Finder >> Cc: "Jared Finder via \"Bug reports for GNU Emacs, the Swiss army >> knife of >> text editors\"" , Robert Pluim >> , >> Gerd Möllmann , Eli Zaretskii >> , 74220 <74220@debbugs.gnu.org>, Avraham Pinkas >> >> >> This was an intentional change to Linux 6.7 to avoid a potential >> privilege escalation. Specifically, apps without the capability >> CAP_SYS_ADMIN are no longer able to set the kernel selection buffer. >> Across Emacs versions, granting the Emacs binary the CAP_SYS_ADMIN >> capability (sudo setcap cap_sys_admin+ep path/to/emacs) fixes the >> issue. > > Sorry, I don't follow: what does setting the kernel selection buffer > have to do with showing the cursor? And how is it related to GPM? > What am I missing here? > >> But is this the right fix? CAP_SYS_ADMIN grants many dangerous >> capabilities on Linux. An alternative fix would be to update redisplay >> on terminals to draw the mouse cursor. Perhaps this is what is done on >> other OSes? I would like guidance here on which path is recommended. > > Let's first understand the problem better. > > (And I'm guessing that by "cursor" you mean "mouse pointer"?) Here's some more specifics: Emacs draws the mouse pointer in handle_one_term_event in term.c. It does this by calling GPM_DrawPointer() with the intended x and y. This code is pretty old, a blame says it was from 2007. GPM_DrawPointer is just a macro, see the GitHub mirror: https://github.com/telmich/gpm/blob/master/src/headers/gpm.h#L235. This calls a Linux ioctl() to draw the cursor. This code is also pretty old, a blame says it was from 2005. The Linux ioctl() is called as follows, if it used symbolic constants and a struct instead of magic byte values: struct { char subcode; short xs, ys, xe, ye; short sel_mode; } gpmbuf; gpmbuf.subcode = TIOCL_SETSEL; // 2 gpmbuf.xs = gpmbuf.xe = x; gpmbuf.ys = gpmbuf.ye = y; gpmbuf.selmode = TIOCL_SELPOINTER; //3 ioctl(fd, TIOCLINUX, &gpmbuf); This adds one other solution -- I could see if it is reasonable for the Linux kernel to not protect TIOCL_SELPOINTER while protecting the rest of TIOCL_SETSEL. I'm a bit nervous here as I don't understand the security implications of SELPOINTER vs other selections, though on first glance it seems reasonable. -- MJF