Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp24292298rwd; Sat, 1 Jul 2023 17:03:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHwrwiBRIW+atxxu8cmqtN1dzD4peXykG6X1AgnQwwUIEk4XnTDlzbdmR41XeFebM0JtfGD X-Received: by 2002:a17:903:22cf:b0:1b8:2537:5428 with SMTP id y15-20020a17090322cf00b001b825375428mr4868731plg.50.1688256238531; Sat, 01 Jul 2023 17:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688256238; cv=none; d=google.com; s=arc-20160816; b=L/1v9nOHz0XvK4RyvbOis6LilYH1yavs/AayMQg/H2pNHgZtJA/reoVrQazsor6hdN vCcUvawPEhC64IjDAWUG4ZFfM3MtH3lPZ/FkOSMzWjanZ9LQIsfe3WQcItZrf/oxFOzJ gPiJciFjF3oh9MMb0Lky1vZ5bGFuOh17Gj4Kn8RbgNtd1wW1kIjPzop4tUorBPpRv1CR zYrcWRmIlYUWgl7Gtktwdky4JeeElesEdQdW3ouKKWh+5wNBkSia/2K7xC9mLiq61OYg XmJWPlkMyx8yDYXjrPdK7bvPGdtjqJ/ON2Xg9DOfRyVhlEOqhsIVFOlKYMrxRAPwzN5k 03rg== 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 Return-Path: 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.03.46; Sat, 01 Jul 2023 17:03:58 -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 S229904AbjGAX73 (ORCPT + 99 others); Sat, 1 Jul 2023 19:59:29 -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 ); 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 ) id 1qFkUp-003nYC-01; Sun, 02 Jul 2023 01:59:19 +0200 Date: Sun, 2 Jul 2023 01:59:18 +0200 From: Samuel Thibault To: Greg Kroah-Hartman , Randy Dunlap , Jiri Slaby , Simon Brand , Kees Cook 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 , Greg Kroah-Hartman , Randy Dunlap , Jiri Slaby , Simon Brand , Kees Cook , 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Fixes: 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled") 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))