Message ID | 20230701235918.kwfathbdklkyrbde@begin |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp11302515vqr; Sat, 1 Jul 2023 17:05:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFv5IUdiHcyF1ptoxnPbwj2Cr27ub3vKgr0cWcwudgAqwxSLZjIHUxBAtSV31hupPE7n39+ X-Received: by 2002:a17:903:228b:b0:1b8:8b6a:c67f with SMTP id b11-20020a170903228b00b001b88b6ac67fmr1578964plh.67.1688256302256; Sat, 01 Jul 2023 17:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688256302; cv=none; d=google.com; s=arc-20160816; b=qhazreoQ+ZJyfH6/SHaeC+i8hcg0HzDSdFxD3senJQAdcjyy/xrW7VU7rV8mrZbCWi W7UooSJoBK3+88uhCtRvn5wsLYCkH+sbWKB5aTb1J383GZO6ViA3tVI3ZMFYZ7PCHHql tVY0mIuj1uONeTLck8osxGDPdAlwkTnQ5d5sNQxbk/fbK05Jad5Ybo3KjZLaBlsTwrd3 F9Ic7XeqXrse/TJdxuD5y1m6pN/l0x/VEhoOYDHF0GxxhgKbQsNQMGplFmMtdPHAPKcj XqU4EzCVHwaIdiSzPLPDk+S0rOrZz3R5+XuHr0PrE881vawaSxi/FVHMvV7D+q5GQVKg 7I3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :mail-followup-to:message-id:subject:cc:to:from:date; bh=1Igvjq/XEor+GoJhEZD/12Vf9uwLuLnUqgr4VpswADk=; fh=H17WsG0XorBXTxub/ekwM5Jv5U9JYM6cGSE7/wwuGoQ=; b=VALI8xSC6XSeWWXOKVM0JsUrlZRIQ3QcwmjrY6YF3a2/WPoydVGXTxTTkGwSWnYkGB mCwfLla25ibeasd3azETQ7/jWf7GwVEQhgP3maCDH/XoMuWHL4buZPZPddReNApRmvxy 3Avpejl2nMTYzJ+i/IFQGyke5Fy+n5AtJhpYEdHqGn/MP4PLt7PEu5wH2EFCfd/qNAjG ZNyWHuKMDQXorsSWEf+YAA/T6OWkYz3iz2b47eqmWldP6zwDvOcsI2lMILTfsGjXuhId olZOr8B1+1UAkckUVVv+BwXsKEv5rsGyjHHSWIp+rPLdpXPwavYjp4MTWgA53cesLHld Xmng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a170902854300b001aafea6f85esi14842333plo.435.2023.07.01.17.04.49; Sat, 01 Jul 2023 17:05:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbjGAX7a (ORCPT <rfc822;nicolai.engesland@gmail.com> + 99 others); Sat, 1 Jul 2023 19:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjGAX72 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 1 Jul 2023 19:59:28 -0400 Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E925172C; Sat, 1 Jul 2023 16:59:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 644672014E; Sun, 2 Jul 2023 01:59:20 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dQ3o_j8e3W-Y; Sun, 2 Jul 2023 01:59:20 +0200 (CEST) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 7464E2014B; Sun, 2 Jul 2023 01:59:19 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from <samuel.thibault@ens-lyon.org>) id 1qFkUp-003nYC-01; Sun, 02 Jul 2023 01:59:19 +0200 Date: Sun, 2 Jul 2023 01:59:18 +0200 From: Samuel Thibault <samuel.thibault@ens-lyon.org> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Randy Dunlap <rdunlap@infradead.org>, Jiri Slaby <jirislaby@kernel.org>, Simon Brand <simon.brand@postadigitale.de>, Kees Cook <keescook@chromium.org> Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org, Dave@mielke.cc Subject: [PATCH] TIOCSTI: always enable for CAP_SYS_ADMIN Message-ID: <20230701235918.kwfathbdklkyrbde@begin> Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Randy Dunlap <rdunlap@infradead.org>, Jiri Slaby <jirislaby@kernel.org>, Simon Brand <simon.brand@postadigitale.de>, Kees Cook <keescook@chromium.org>, stable@vger.kernel.org, linux-kernel@vger.kernel.org, Dave@mielke.cc MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770265040692324415?= X-GMAIL-MSGID: =?utf-8?q?1770265040692324415?= |
Series |
TIOCSTI: always enable for CAP_SYS_ADMIN
|
|
Commit Message
Samuel Thibault
July 1, 2023, 11:59 p.m. UTC
83efeeeb3d04 ("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 <samuel.thibault@ens-lyon.org>
Fixes: 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled")
Comments
On Sun, Jul 02, 2023 at 01:59:18AM +0200, Samuel Thibault wrote: > 83efeeeb3d04 ("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 <samuel.thibault@ens-lyon.org> > Fixes: 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled") Based on the design of brltty, this appears to be the only solution. I remain surprised that FreeBSD had no brltty support, which is why they didn't run into this problem. Acked-by: Kees Cook <keescook@chromium.org> -Kees > > Index: linux-6.4/drivers/tty/tty_io.c > =================================================================== > --- linux-6.4.orig/drivers/tty/tty_io.c > +++ linux-6.4/drivers/tty/tty_io.c > @@ -2276,7 +2276,7 @@ static int tiocsti(struct tty_struct *tt > 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))
Index: linux-6.4/drivers/tty/tty_io.c =================================================================== --- linux-6.4.orig/drivers/tty/tty_io.c +++ linux-6.4/drivers/tty/tty_io.c @@ -2276,7 +2276,7 @@ static int tiocsti(struct tty_struct *tt 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))