[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200602200534.GA17363@otc-nc-03>
Date: Tue, 2 Jun 2020 13:05:35 -0700
From: "Raj, Ashok" <ashok.raj@...el.com>
To: Rajat Jain <rajatja@...gle.com>
Cc: David Woodhouse <dwmw2@...radead.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
Mika Westerberg <mika.westerberg@...el.com>,
lalithambika.krishnakumar@...el.com, rajatxjain@...il.com,
pmalani@...gle.com, bleung@...gle.com, levinale@...gle.com,
zsm@...gle.com, mnissler@...gle.com, tbroch@...gle.com,
Ashok Raj <ashok.raj@...el.com>
Subject: Re: [PATCH v2] iommu/vt-d: Don't apply gfx quirks to untrusted
devices
Hi Rajat
On Tue, Jun 02, 2020 at 11:41:33AM -0700, Rajat Jain wrote:
> Currently, an external malicious PCI device can masquerade the VID:PID
> of faulty gfx devices, and thus apply iommu quirks to effectively
> disable the IOMMU restrictions for itself.
>
> Thus we need to ensure that the device we are applying quirks to, is
> indeed an internal trusted device.
>
> Signed-off-by: Rajat Jain <rajatja@...gle.com>
> Acked-by: Lu Baolu <baolu.lu@...ux.intel.com>
> ---
> V2: - Change the warning print strings.
> - Add Lu Baolu's acknowledgement.
>
> drivers/iommu/intel-iommu.c | 38 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index ef0a5246700e5..fdfbea4ff8cb3 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -6214,6 +6214,13 @@ const struct iommu_ops intel_iommu_ops = {
>
> static void quirk_iommu_igfx(struct pci_dev *dev)
> {
> + if (dev->untrusted) {
> + pci_warn(dev,
> + "Skipping IOMMU quirk %s() for potentially untrusted device\n",
> + __func__);
> + return;
> + }
> +
This check and code seems to be happening several times. Maybe add a simple
function to do the test and use in all places?
Cheers,
Ashok
Powered by blists - more mailing lists