Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp34687815rwd; Sun, 9 Jul 2023 18:18:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNivOB/8axyQWCypMrhOQgAQlPutqSdwbyunEan4QdmQ0Rtfv3zdwhnmEoXHquiRbmuE3c X-Received: by 2002:a17:902:ce84:b0:1b8:5aa1:4d10 with SMTP id f4-20020a170902ce8400b001b85aa14d10mr12648756plg.54.1688951898130; Sun, 09 Jul 2023 18:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688951898; cv=none; d=google.com; s=arc-20160816; b=IqHR4+YGDtjKs0oJHWvYFiuCFFsV8bJ92h+mp+abuEWGWoBncac4Aeb1Te2jK5QGEF Mqg/xsunWM0hRf8fdtJQ+gwBklqR9kODplZHGSZwcOSka8ZZ2UzOsN2pyQxIcbQRAdS8 Iel6ao3fbSDH0eUFTuA8kOxnPrlEKY971y7E3GsbNBjcnt47d6MPAWBx29WnV1CzhmXz QHOoSL2eWcB0tgVrwuMTegUQ+sKc8NRBeXvqU9jEA1D2UKZ0uNSHHt1yMP2yFl31HQCN tuFfGJ6bY02JpdHFZVlmPchafLYvscbetXWxWrLsyC4faSJbQqcN/PL1nHRZbGJSBDMF XYBQ== 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=0oxpsIdif9Vyu5/rwnma5uHUTwsqOnTvUFqQlQn7pzA=; fh=vPPFO9Cz1cnYYkMsGjKN6hXWaGysjjyBBxYd/bHeFEc=; b=ujqz/rYj1im5kqA7GFqk7lH/rax1jsOJJcwYCDiXa100+ujzx/VQgU6LhnHerXpT64 n2FIm+2MnMv+xJBxAquQ+fifObAsKhw4Taoob7cOswLRKqHHxJtEFboyaD+UmdhFk94S DYidLSjmp7gaPKWhuQ42Ym6prbDMtC+iN6xN0e455GARFIknqrDh7hi544Re27MB/rc0 tZiGVIzmTIiqdKc0cuVQ9498Q9ctCmgp5CakC2sqd3Yxoax2UTM6o1uzwOPbqD/8A5kc XzyHaBKCNW+uGicQJlBlvlchB8hW6dI/nv5enIiu8Xx06lp4d6w+1PUXy/5NS4wqoQrM gqVQ== 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 l5-20020a170902f68500b001b9e2ce5723si650003plg.495.2023.07.09.18.18.05; Sun, 09 Jul 2023 18:18:18 -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 S229760AbjGJA04 (ORCPT + 99 others); Sun, 9 Jul 2023 20:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjGJA0z (ORCPT ); Sun, 9 Jul 2023 20:26:55 -0400 Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996A311C for ; Sun, 9 Jul 2023 17:26:53 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 1907720156; Mon, 10 Jul 2023 02:26:46 +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 Pi8yPwfYqiJA; Mon, 10 Jul 2023 02:26:45 +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 88F7020155; Mon, 10 Jul 2023 02:26:45 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1qIejl-00FI59-0C; Mon, 10 Jul 2023 02:26:45 +0200 Date: Mon, 10 Jul 2023 02:26:45 +0200 From: Samuel Thibault To: Greg Kroah-Hartman , Randy Dunlap , Jiri Slaby , Simon Brand , Kees Cook Cc: linux-kernel@vger.kernel.org, Dave@mielke.cc Subject: [PATCH] TIOCSTI: always enable for CAP_SYS_ADMIN Message-ID: <20230710002645.v565c7xq5iddruse@begin> Mail-Followup-To: Samuel Thibault , Greg Kroah-Hartman , Randy Dunlap , Jiri Slaby , Simon Brand , Kees Cook , 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_BLOCKED,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 Acked-by: Kees Cook Fixes: 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled") Cc: stable@vger.kernel.org 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))