Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19500819rwd; Wed, 28 Jun 2023 10:05:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VlrhYbo5qMc39FDutfz8+5CCe08Ne4VpTYXEeVCGvgsTjf4v57NLtqFjuGgsc5J+Ag0Gn X-Received: by 2002:a17:902:f681:b0:1ac:8be5:8787 with SMTP id l1-20020a170902f68100b001ac8be58787mr10352067plg.21.1687971912285; Wed, 28 Jun 2023 10:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687971912; cv=none; d=google.com; s=arc-20160816; b=wffoDChm40RwoLQeYm/ZwtuLC+1syFOO+20Jc6tEr6Zo80yNn5PXrRDnRx2/8oxy5r 6nrcf7kbwxrDIiZog1+iymLjBBDRJXX4dDZUwdNOa0Fc9AhSUKnXaTL3m4w4pUCPvjco zooNkcJvSqqm9camwvKNlwoaU/5Z/7CkEsqoN3GO8pmCURGCFOxe0t1XJ9Ee53UyOJtY CHDEt82s+2+pxeKOn2PHPIjiC1PEILuMnv9+kVtjfoKkiaOhwq4zbAwLOpPbhabLC5CC SsCvvaAlfvRY2mCZdMEcp+j4pMXgGM8bCmbmEZynX++iZByNfX3xHYQoHtG8pGr1krqx bLSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=qDGMYCjLis4jKxTwr/XdUXoNY3JVle8y3T0ovRza2gI=; fh=99zS+TvvmKOJVgc8bRV81bREKQeHV0MAxwmKYws+Lfk=; b=pxkW7xh0jvcChtnmhE37bI36NMbKd9Dp9eKcQeOxr0QkMjcQY+s4doS5Covolp660T 3HSlQI13ohWdFvV4v04bi0+TutT7qVnTQQXOqnSoG7MjYLsJ7ZwpEkUNhvJfQHYLsErH yi9nm6oQT5XsPZqDHTmKh4nvPzdt8QeyEuQTOswBvXj14PawOuxlSoRpz5FxjjFq3the gqi4ryb4/Q0lDpRcGIS/Tbgm0J9+JMWFruOnfI834RAQzFQKayLO8ByViP0WBaz5KbVw P95G7GlxQ2hK8mY2LVEzGvmrE8hqvdrCRXg44HUR1qcBf+MpMMF56kpTrHMCrUkMH/w0 InyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=So0cQmmY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf11-20020a170902b90b00b001a68f933777si8934227plb.245.2023.06.28.10.04.48; Wed, 28 Jun 2023 10:05:12 -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; dkim=pass header.i=@chromium.org header.s=google header.b=So0cQmmY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbjF1QdE (ORCPT + 99 others); Wed, 28 Jun 2023 12:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbjF1Qcb (ORCPT ); Wed, 28 Jun 2023 12:32:31 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5000419AF for ; Wed, 28 Jun 2023 09:32:23 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6687096c6ddso3375785b3a.0 for ; Wed, 28 Jun 2023 09:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687969943; x=1690561943; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=qDGMYCjLis4jKxTwr/XdUXoNY3JVle8y3T0ovRza2gI=; b=So0cQmmYjKO65vw+/JsinQBhmojmi5xblarthQ+XwK6zfOrl6nidesbKTUolCr2pTj v6gEfN3NB9a8q4sxVqNolfWNnRp4XqLAHKowxUgtk9uf3sWNhisK6K8UMc+/sGQs7zl3 7wNc+mBDuFAzumNdKdKkBJsTHBdBLtEE96zHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687969943; x=1690561943; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qDGMYCjLis4jKxTwr/XdUXoNY3JVle8y3T0ovRza2gI=; b=KBxB4o4yYmoDhaaXjjq9taZLE9KXQTy1qVKPqp1VCT+d2kyWVXXRpAkddUBidq3UYm ZWKAsCiGhn3KDVsHbSax3xDvBGi6I0+xNzrw68Q07/8dVsmx4BJ1fAgAfrvw/crKJsvY 1zBKwBobL8TvFMf+DJJVixKwUpv9BQDwjQtMcGFUJcmKz9RNdmrdqJZvp5p35Rh3oOcx BrdScM54twWY+mkwEugOFI0/TRJ9LG8Gb3ItHWGH34/TFaI6nd9Vlqqb0Yi+o27RaNLw jG3lSmNLataLaFBz4OZFAuhzPzNurhJHphOtiPtbLChPV3S1XuENehTWANoaz7klKnPC M/zQ== X-Gm-Message-State: AC+VfDwJf96vHUTwGLVvrlSxgqrpBqY+rv5lTooV6q9Ay6ZygglI2wia O/VzBfyxABNwgw5ZxEq0nDYyyy/4iXkQfl1D8dQ= X-Received: by 2002:a05:6a00:3994:b0:66a:3812:7eda with SMTP id fi20-20020a056a00399400b0066a38127edamr20180226pfb.9.1687969942751; Wed, 28 Jun 2023 09:32:22 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id bm2-20020a056a00320200b00681783cfc85sm1263377pfb.144.2023.06.28.09.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 09:32:21 -0700 (PDT) Date: Wed, 28 Jun 2023 09:32:20 -0700 From: Kees Cook To: Samuel Thibault , Kees Cook , Greg Kroah-Hartman , Jiri Slaby , Simon Brand , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Dave@mielke.cc Subject: Re: [PATCH v3 2/2] tty: Allow TIOCSTI to be disabled Message-ID: <202306280930.8CBBB9B@keescook> References: <20221022182828.give.717-kees@kernel.org> <20221022182949.2684794-2-keescook@chromium.org> <20221227234000.jgosvixx7eahqb3z@begin> <20221228205726.rfevry7ud6gmttg5@begin> <20230625155625.s4kvy7m2vw74ow4i@begin> <202306271944.E80E1D0@keescook> <20230628060716.vvgtlgbushyjh6km@begin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230628060716.vvgtlgbushyjh6km@begin> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Wed, Jun 28, 2023 at 08:07:16AM +0200, Samuel Thibault wrote: > Kees Cook, le mar. 27 juin 2023 19:48:45 -0700, a ecrit: > > On Sun, Jun 25, 2023 at 05:56:25PM +0200, Samuel Thibault wrote: > > > > Can we perhaps just introduce a CAP_TIOCSTI that the brltty daemon would > > > > be able to use? We could even make it only allow TIOCSTI on the linux > > > > console (tty->ops == con_ops). > > > > Does brltty run with CAP_SYS_ADMIN? > > ATM most often, yes, though we are trying to reduce the CAP_* privileges > to what it actually needs. > > > > *Please* comment on this so we can progress. ATM people are > > > advising each other to set dev.tty.legacy_tiocsti=1, which is just > > > counter-productive in terms of security... > > > > So is there really no solution for brltty and TIOCSTI being disabled? > > No, there is no way to simulate characters on the Linux console. The > alternative would be to use uinput, but that simulates keycodes, not > characters, thus requiring backtranslating first, which is very fragile. > > > What is FreeBSD doing? I imagine it's the same situation there too, > > though maybe there is just no support? > > There is just no support in the kernel, only a patch against "screen". > > > > Really, this a serious regression for the people affected by this. > > > > Can you send a patch adding a CAP_SYS_ADMIN exception? > > Sure! Thanks! (And be sure to use file->f_cred for the check[1], not "current", that way brltty can open the tty and drop caps and still do the ioctl.) -Kees https://docs.kernel.org/security/credentials.html?highlight=confused+deputy#open-file-credentials -- Kees Cook