Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp68099pxb; Fri, 5 Mar 2021 14:43:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxk+Nq6VEHON2sgP7iebU3UBKr7QTtdIRtKGUHpSCrb6fTGPTuCBD9PByyqjnxKfokubvVD X-Received: by 2002:a05:6402:a:: with SMTP id d10mr6868763edu.361.1614984229931; Fri, 05 Mar 2021 14:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614984229; cv=none; d=google.com; s=arc-20160816; b=FhW4biUOfOr+xByToQbeNbBWkfDGYh26lG7KHBPYOX/vOKssOLGwBh/j7PuTeUS6YI QXt4YDqAjfbRryHSifk22g5r3HUH2shLDp3jhrg9mK6rZun9sX3GQgh5MOe5mn0iXeAS ebTP2jblodglXxVxevizO0+F4twWlms2EvCbs7dGf8kjJ/YZsI0M2kB4WWtdwS3QQkMb 5Um9lTIgqb0JuZZcDTr7DlQmCq5edoUsXZNPPqFOEEqPCaUt2zhxRSJ234C3V3pT2nzW maeRvWr8BcL0umUyM84uovZBhUkprOUY3On7QQFTLwTJxgrK+hSUQFdBjTjU+hczMhol 5/Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=1Hf0KRttTe8cGERmnEIme11FED0x4FRne4Zt9+1960o=; b=DT27tiXrnZwz3XFgkuR/7Nh+uyHHwYlQJvBSAh/QSoCmF2hbbTatDkLcpCA9MFGRpt WvfxBgauN9Em0vmjkecDVWEZL0Mpwof1PhM7FNexgEGLhxTFoVc6K3aB0E2P/LDey71q nj4TqoeQUPZfeAgLz5Nuj+mZJDdRA+QxwCQldFGeMY5P9hiVrXub1WJMzujYIQqPA25/ 6FLwB+nfUJ8l0VR16pUU42yNXmVibmOID1yDpxFN5a5xVFldtUJowiR8P7WJJ74HOk8c /vLn0mhpIepLnmIyeUDrE9RwP6tbevflJfyUfs7p6gvXmIkCoEgVEPgKsW1l6SNWZ19R 5cDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u8si2116180ejf.255.2021.03.05.14.43.26; Fri, 05 Mar 2021 14:43:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229601AbhCEWma (ORCPT + 99 others); Fri, 5 Mar 2021 17:42:30 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:48246 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhCEWm3 (ORCPT ); Fri, 5 Mar 2021 17:42:29 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 63F581C0B81; Fri, 5 Mar 2021 23:42:27 +0100 (CET) Date: Fri, 5 Mar 2021 23:42:26 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Adam Nichols , Chris Leech , Mike Christie , Lee Duncan , "Martin K. Petersen" Subject: Re: [PATCH 5.10 083/102] scsi: iscsi: Restrict sessions and handles to admin capabilities Message-ID: <20210305224226.GA801@amd> References: <20210305120903.276489876@linuxfoundation.org> <20210305120907.364742631@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qxx1br4bt0+wmkIi" Content-Disposition: inline In-Reply-To: <20210305120907.364742631@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Lee Duncan >=20 > commit 688e8128b7a92df982709a4137ea4588d16f24aa upstream. >=20 > Protect the iSCSI transport handle, available in sysfs, by requiring > CAP_SYS_ADMIN to read it. Also protect the netlink socket by restricting > reception of messages to ones sent with CAP_SYS_ADMIN. This disables > normal users from being able to end arbitrary iSCSI sessions. Should not normal filesystem permissions be used? > +++ b/drivers/scsi/scsi_transport_iscsi.c > @@ -132,6 +132,9 @@ show_transport_handle(struct device *dev > char *buf) > { > struct iscsi_internal *priv =3D dev_to_iscsi_internal(dev); > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EACCES; > return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->is= csi_transport)); > } > static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); AFAICT we make the file 0444 (world readable) and then fail the read with capability check. If the file is not supposed to be world-readable, it should have 0400 permissions, right? Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --Qxx1br4bt0+wmkIi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmBCs9IACgkQMOfwapXb+vIsdwCgjcQuK8NkqZ8lM4jIvGfPCp1N Th4AoKvOHXdxsh61FJi5vnG6bJ8zD4yF =wfqM -----END PGP SIGNATURE----- --Qxx1br4bt0+wmkIi--