patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Christian Benvenuti <benve@cisco.com>,
	Heiko Stuebner <heiko@sntech.de>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Joerg Roedel <joro@8bytes.org>, Leon Romanovsky <leon@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-rockchip@lists.infradead.org"
	<linux-rockchip@lists.infradead.org>,
	"linux-sunxi@lists.linux.dev" <linux-sunxi@lists.linux.dev>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Nelson Escobar <neescoba@cisco.com>,
	Rob Clark <robin.clark@oss.qualcomm.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Samuel Holland <samuel@sholland.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Chen-Yu Tsai <wens@csie.org>, Will Deacon <will@kernel.org>,
	Yong Wu <yong.wu@mediatek.com>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	"patches@lists.linux.dev" <patches@lists.linux.dev>
Subject: Re: [PATCH v2 2/3] iommu/amd: Don't call report_iommu_fault()
Date: Thu, 20 Nov 2025 15:35:06 -0400	[thread overview]
Message-ID: <20251120193506.GE153257@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB5276858062B57F944A7EBE778CD6A@BN9PR11MB5276.namprd11.prod.outlook.com>

On Tue, Nov 18, 2025 at 11:58:39PM +0000, Tian, Kevin wrote:
> > > > -
> > > > -			if (!report_iommu_fault(&dev_data->domain-
> > > > >domain,
> > > > -						&pdev->dev, address,
> > > > -						IS_WRITE_REQUEST(flags) ?
> > > > -
> > > > 	IOMMU_FAULT_WRITE :
> > > > -
> > > > 	IOMMU_FAULT_READ))
> > > > -				goto out;
> > > >  		}
> > > >
> > > >  		if (__ratelimit(&dev_data->rs)) {
> > >
> > > Remove amd_iommu_report_page_fault() too?
> > 
> > I don't understand this remark?
> > 
> > amd_iommu_report_page_fault() generates the dmesg logging on iommu
> > faults?
> 
> sorry I meant generating the dmesg logging same as other error
> types in iommu_print_event(). No need for a separate function.

Okay, that does make sense, but this driver is kinda broken because it
is using 

	pdev = pci_get_domain_bus_and_slot(iommu->pci_seg->id, PCI_BUS_NUM(devid),
					   devid & 0xff);
	if (pdev)
		dev_data = dev_iommu_priv_get(&pdev->dev);

Which is UAF racy on dev_data.

Fixing that is troublesome..

Really all the fault handling here needs some attention, all the
events that have BDFs should all print the same, using a pci print or
using raw BDFs. Translation fault shouldn't be special..

Too big for this series, so I'll leave it..

Thanks,
Jason



  reply	other threads:[~2025-11-20 19:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 20:34 [PATCH v2 0/3] Cleanup around iommu_set_fault_handler() Jason Gunthorpe
2025-11-06 20:34 ` [PATCH v2 1/3] RDMA/usnic: Remove iommu_set_fault_handler() Jason Gunthorpe
2025-11-17  6:37   ` Tian, Kevin
2025-11-06 20:34 ` [PATCH v2 2/3] iommu/amd: Don't call report_iommu_fault() Jason Gunthorpe
2025-11-08 11:17   ` Vasant Hegde
2025-11-18 18:57     ` Jason Gunthorpe
2025-11-17  6:38   ` Tian, Kevin
2025-11-18 18:58     ` Jason Gunthorpe
2025-11-18 23:58       ` Tian, Kevin
2025-11-20 19:35         ` Jason Gunthorpe [this message]
2025-11-06 20:34 ` [PATCH v2 3/3] iommu: Allow drivers to say if they use report_iommu_fault() Jason Gunthorpe
2025-11-08 11:20   ` Vasant Hegde
2025-11-17  6:43   ` Tian, Kevin
2025-11-18  1:30   ` Chaoyi Chen
2025-11-18 19:00     ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251120193506.GE153257@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=benve@cisco.com \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=matthias.bgg@gmail.com \
    --cc=neescoba@cisco.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=robin.murphy@arm.com \
    --cc=samuel@sholland.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=wens@csie.org \
    --cc=will@kernel.org \
    --cc=yong.wu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).