Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp606519rdb; Mon, 15 Jan 2024 07:40:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFq4U4C3e1ameXAyx2ztXtU0ISZVONynN50CGd+lsvnq4c3uYtixTXh6opjuK+w/tmyqKWI X-Received: by 2002:a17:903:24c:b0:1d3:eca1:91b8 with SMTP id j12-20020a170903024c00b001d3eca191b8mr8068128plh.46.1705333258173; Mon, 15 Jan 2024 07:40:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705333258; cv=none; d=google.com; s=arc-20160816; b=u5ZF17Gam8M/l+Oh/q97/EwZzZ4PH4hlWeJuVPQmgZUyO0R0Lbtb7rBgElMvQyrx2k VR55p2FnpG21RSnStuwvB5+2gEP/vL0Ftls7xUmN4GkZIONPnskOn+LJZYHY6Ltb8vfv /i1IGpZaganoKi10nXksXg0yBe67txSpsPlvoCtjkkLAdCleBWPvA578SpUsGDmwlaB4 GtXHUOiVM/0u1sMKKGTXY31TNy/Zz+5/EstNEOnAckPVAsRevV7+riZ+a9jrHU4dt51y /YTQxlHPHeuYyLQ84c4WjkyvNUyDmGYvZ/I39jJzWFigBvixcG94kqcwmn4BFJlvNvPK ncdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XqCJJGgouq1uZAy2OUjM+sizGYbyHCYz4kmYp9j0jkI=; fh=qboFWmj/uCtCCr+eQN0ybWKW/Sr3nyMPRFmpFjNR3fQ=; b=FKDkaWe+vGC439PNzhdGAWaVRDCSjZUThO429eazEVf1fqtX2l6pqUIlZckZGymQY7 zCGLse4TGjHoaVcZbSkSDqdQfzErnAAi1Li39LFJwU5lS6WT5L8NXV2MbrW3hmDfHc5n nE1oz04ChHADgx+NYe2qtlWnwYlstGTepqUXRNpOBcS1NBdDRZDP1qE/bsczXZ3HJCmt E6JXfe0Q+sx0vTbi7BrEax4wb9ecGy5XC3+KecclhkFd4ld3Ju6zWqAv4P4a4gqHHabB NfsnvpsoQWOsSTxJXXYM2xgnm1Yu2Pkxvu2sKw2pBzc8E9y/M6cIm91XokPsmkRYltdm AElQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lwQ8LtpP; spf=pass (google.com: domain of linux-kernel+bounces-26177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h9-20020a170902f7c900b001d48130213asi9180744plw.383.2024.01.15.07.40.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 07:40:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lwQ8LtpP; spf=pass (google.com: domain of linux-kernel+bounces-26177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9194D283B10 for ; Mon, 15 Jan 2024 15:34:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 748A61774E; Mon, 15 Jan 2024 15:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lwQ8LtpP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B70C17980; Mon, 15 Jan 2024 15:34:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E5BEC433F1; Mon, 15 Jan 2024 15:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705332845; bh=GqeW8XFU0wr6W83/qQL3PqOyONODN3AZrhkX/pLrilQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lwQ8LtpPqlmLuJMoprhcFoXM3+Cps/V3xxCEw8khijNXyQKFVTMppLUOGRTggzMkL ylP4U2kaDVBFuC1vqUnsmSOzWKQPQ7cUKM69B/RrJ5HifJYy38bILtZbdpk4ToyN+R JHbrtaHt8CSJhHdaRkJDFCYJF3Am0u6bPRzIxlC8= Date: Mon, 15 Jan 2024 16:34:02 +0100 From: Greg KH To: =?utf-8?B?5a2f5pWs5ae/?= Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] tty: change the privilege required for tty operarions Message-ID: <2024011556-barbecue-tackiness-78be@gregkh> References: <2024010247-polio-brittle-1b23@gregkh> <20240115082420.13372-1-mengjingzi@iie.ac.cn> <2024011523-lifter-narrow-fed3@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Jan 15, 2024 at 11:10:29PM +0800, 孟敬姿 wrote: > > 在 2024-1-15 16:35, Greg KH 写道: > > On Mon, Jan 15, 2024 at 04:24:20PM +0800, Jingzi Meng wrote: > > > Currently, CAP_SYS_ADMIN is responsible for tty-related functions in > > > tty_ioctl(): TIOCSTI, TIOCCONS, TIOCVHANGUP. CAP_SYS_ADMIN is already > > > overloaded, change it to CAP_SYS_TTY_CONFIG for a more fine-grained > > > and accurate access control. > > > > > > Signed-off-by: Jingzi Meng > > > --- > > > > > > The userland api affected by this change is the ioctl system call, > > > especially when the second argument is TIOCSTI, TIOCCONS, TIOCVHANGUP, > > > which now requires sys_tty_config instead of sys_admin. Tested on Debian > > > with kernel 6.7.0-rc5. > > Tested how? You are changing the permissions of a kernel operation, > > which is arguably, going to break userspace in lots of interesting ways > > unless you can prove that this is functionally the same as the existing > > code. > > > > And not all the world is Debian (although lots of it is, yes.) But > > actually running programs that exercise this kernel codepath is going to > > be the key, did you do that? > > > First of all, this change is not about functionality, only about permissions. I'm confused, permissions dictate functionality. If I do not have permissions to do something, the functionality is suddenly not there. That's what you are doing here, you are changing the requirement of previously one capability was required to achive a function in the kernel, to a different capability. So it is ALL ABOUT functionality here. > I wrote 3 testcases which calls ioctl() with TIOCSTI, TIOCCONS, TIOCVHANGUP > respectively. Then execute them on the origin kernel and patched kernel. > Running it on both sets of kernels gives the same result. However, through > the system error message, and the kernel log output I added, I confirmed > that the relevant functionality under the origin kernel requires sys_admin, > and under the patched kernel requires sys_tty_config. I'm referring to existing programs that are not modified to have the new capability that you are now requiring. Who is going to do that work? Where are they? How have you searched to find them? > Indeed, it doesn't have much to do with the distro either, I just tested it > on Debian, and similar tests can be done on other distros. That's not the issue, the issue is "what existing software is going to break with this change in permission handling." That needs to be answered first, and I suggest some research into how we HAVE TO keep backwards compability and can not break it. Without some more proof, this type of change can never be accepted, nor would you want it to be. good luck! greg k-h