From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B5FC433E0 for ; Thu, 18 Jun 2020 18:46:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 277B9208DB for ; Thu, 18 Jun 2020 18:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592505997; bh=39kwGWJQnjfPiKs05x4HsotVBIPPsgkmzXLdYD1Ko8E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=EQ9wiapmoAfM+Yxeg3rQNTlNF43tuIg0wvBIq9Mxhrku1XsDo9y7FwokJOl0xdXDd fkuKbjhHMss4V7vvcZU2eh62ylCIm1YXmXRK6TqgXVIJy8Li25n1dYRUQkpTvqR7s7 GmNgf5OWww6lrnFURm6IcyXZW6NhojoL1wytNcBk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728889AbgFRSqd (ORCPT ); Thu, 18 Jun 2020 14:46:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:56210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727805AbgFRSqa (ORCPT ); Thu, 18 Jun 2020 14:46:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B2B2208DB; Thu, 18 Jun 2020 18:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592505989; bh=39kwGWJQnjfPiKs05x4HsotVBIPPsgkmzXLdYD1Ko8E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ji8AXAluHvvoAmMwrjxl6TLNm7J2vVNMEj/eNho7vDCFnChfn98b6KVXCtZxL1CFE rGdaWGvdez9DKhhUd+a6J00iz0MRvJO/NRn8tTpyPk3hgUM520s8gGhy692qvYxDx6 1rgnQYgfRwNPX6/IxJPJpm+MD8Z+tVbt6MWvsfsU= Date: Thu, 18 Jun 2020 20:46:21 +0200 From: Greg Kroah-Hartman To: Rajat Jain Cc: "Raj, Ashok" , Andy Shevchenko , Christoph Hellwig , David Woodhouse , Lu Baolu , Joerg Roedel , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , iommu@lists.linux-foundation.org, Linux Kernel Mailing List , linux-pci , ACPI Devel Maling List , "Krishnakumar, Lalithambika" , Mika Westerberg , Jean-Philippe Brucker , Prashant Malani , Benson Leung , Todd Broch , Alex Levin , Mattias Nissler , Rajat Jain , Bernie Keany , Aaron Durbin , Diego Rivas , Duncan Laurie , Furquan Shaikh , Jesse Barnes , Christian Kellner , Alex Williamson , Oliver O'Halloran , Jean-Philippe Brucker Subject: Re: [PATCH 4/4] pci: export untrusted attribute in sysfs Message-ID: <20200618184621.GA446639@kroah.com> References: <20200617073100.GA14424@infradead.org> <20200618083646.GA1066967@kroah.com> <20200618160212.GB3076467@kroah.com> <20200618162322.GI34820@otc-nc-03> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, Jun 18, 2020 at 10:23:38AM -0700, Rajat Jain wrote: > Thanks Greg and Andy for your continued inputs, and thanks Ashok for chiming in. > > On Thu, Jun 18, 2020 at 9:23 AM Raj, Ashok wrote: > > > > Hi Greg, > > > > > > On Thu, Jun 18, 2020 at 06:02:12PM +0200, Greg Kroah-Hartman wrote: > > > On Thu, Jun 18, 2020 at 08:03:49AM -0700, Rajat Jain wrote: > > > > Hello, > > > > > > > > On Thu, Jun 18, 2020 at 2:14 AM Andy Shevchenko > > > > wrote: > > > > > > > > > > On Thu, Jun 18, 2020 at 11:36 AM Greg Kroah-Hartman > > > > > wrote: > > > > > > > > > > > > On Thu, Jun 18, 2020 at 11:12:56AM +0300, Andy Shevchenko wrote: > > > > > > > On Wed, Jun 17, 2020 at 10:56 PM Rajat Jain wrote: > > > > > > > > On Wed, Jun 17, 2020 at 12:31 AM Christoph Hellwig wrote: > > > > > > > > > > > > > > ... > > > > > > > > > > > > > > > (and likely call it "external" instead of "untrusted". > > > > > > > > > > > > > > Which is not okay. 'External' to what? 'untrusted' has been carefully > > > > > > > chosen by the meaning of it. > > > > > > > What external does mean for M.2. WWAN card in my laptop? It's in ACPI > > > > > > > tables, but I can replace it. > > > > > > > > > > > > Then your ACPI tables should show this, there is an attribute for it, > > > > > > right? > > > > > > > > > > There is a _PLD() method, but it's for the USB devices (or optional > > > > > for others, I don't remember by heart). So, most of the ACPI tables, > > > > > alas, don't show this. > > > > > > > > > > > > This is only one example. Or if firmware of some device is altered, > > > > > > > and it's internal (whatever it means) is it trusted or not? > > > > > > > > > > > > That is what people are using policy for today, if you object to this, > > > > > > please bring it up to those developers :) > > > > > > > > > > > > So, please leave it as is (I mean name). > > > > > > > > > > > > firmware today exports this attribute, why do you not want userspace to > > > > > > also know it? > > > > > > > > To clarify, the attribute exposed by the firmware today is > > > > "ExternalFacingPort" and "external-facing" respectively: > > > > > > > > 617654aae50e ("PCI / ACPI: Identify untrusted PCI devices") > > > > 9cb30a71ac45d("PCI: OF: Support "external-facing" property") > > > > > > > > The kernel flag was named "untrusted" though, hence the assumption > > > > that "external=untrusted" is currently baked into the kernel today. > > > > IMHO, using "external" would fix that (The assumption can thus be > > > > contained in the IOMMU drivers) and at the same time allow more use of > > > > this attribute. > > > > > > > > > > > > > > > > Trust is different, yes, don't get the two mixed up please. That should > > > > > > be a different sysfs attribute for obvious reasons. > > > > > > > > > > Yes, as a bottom line that's what I meant as well. > > > > > > > > So what is the consensus here? I don't have a strong opinion - but it > > > > seemed to me Greg is saying "external" and Andy is saying "untrusted"? > > > > > > Those two things are totally separate things when it comes to a device. > > > > Agree that these are two separate attributes, and better not mixed. > > +1. > > > > > > > > > One (external) describes the location of the device in the system. > > > > > > The other (untrusted) describes what you want the kernel to do with this > > > device (trust or not trust it). > > > > > > One you can change (from trust to untrusted or back), the other you can > > > not, it is a fixed read-only property that describes the hardware device > > > as defined by the firmware. > > Correct. I believe what is being described by the firmware is a fixed > read-only property describing the location of the device ("external") > - not what to do with it ("untrusted"). > > > > > The genesis is due to lack of a mechanism to establish if the device > > is trusted or not was the due lack of some specs and implementation around > > Component Measurement And Authentication (CMA). Treating external as > > untrusted was the best first effort. i.e trust internal > > devices and don't trust external devices for enabling ATS. > > > > But that said external is just describing topology, and if Linux wants to > > use that in the policy that's different. Some day external device may also > > use CMA to estabilish trust. FWIW even internal devices aren't trust > > worthy, except maybe RCIEP's. > > Correct. Since the firmware is actually describing the unchangeable > topology (and not the policy), the takeaway I am taking from this > discussion is that the flag should be called "external". The attribute should be called something like "location" or something like that (naming is hard), as you don't always know if something is external or not (it could be internal, it could be unknown, it could be internal to an external device that you trust (think PCI drawers for "super" computers that are hot pluggable but yet really part of the internal bus). > Like I said, I don't have any hard opinions on this. So if you feel > that my conclusion is wrong and consensus was the other way around > ("untrusted"), let me know and I'll be happy to change this. "trust" has no direct relation to the location, except in a policy of what you wish to do with that device, so as long as you keep them separate that way, I am fine with it. thanks, greg k-h