public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>, <asahi@lists.linux.dev>,
	<iommu@lists.linux.dev>, Joerg Roedel <joro@8bytes.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kselftest@vger.kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Shuah Khan <shuah@kernel.org>, "Will Deacon" <will@kernel.org>,
	Eric Auger <eric.auger@redhat.com>, Janne Grunau <j@jannau.net>,
	Joerg Roedel <jroedel@suse.de>, Kevin Tian <kevin.tian@intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Lixiao Yang <lixiao.yang@intel.com>,
	Hector Martin <marcan@marcan.st>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	<patches@lists.linux.dev>, "Sven Peter" <sven@svenpeter.dev>,
	Will Deacon <will.deacon@arm.com>, Yi Liu <yi.l.liu@intel.com>,
	Yong Wu <yong.wu@mediatek.com>
Subject: Re: [PATCH rc 1/2] iommufd: Do not allow creating areas without READ or WRITE
Date: Fri, 23 Aug 2024 09:29:32 -0700	[thread overview]
Message-ID: <Zsi47Ek88/f42hDd@Asurada-Nvidia> (raw)
In-Reply-To: <1-v1-1211e1294c27+4b1-iommu_no_prot_jgg@nvidia.com>

On Thu, Aug 22, 2024 at 11:45:54AM -0300, Jason Gunthorpe wrote:
> This results in passing 0 or just IOMMU_CACHE to iommu_map(). Most of
> the page table formats don't like this:
> 
>   amdv1 - -EINVAL
>   armv7s - returns 0, doesn't update mapped
>   arm-lpae - returns 0 doesn't update mapped
>   dart - returns 0, doesn't update mapped
>   VT-D - returns -EINVAL
> 
> Unfortunately the three formats that return 0 cause serious problems:
> 
>  - Returning ret = but not uppdating mapped from domain->map_pages()
>    causes an infinite loop in __iommu_map()
> 
>  - Not writing ioptes means that VFIO/iommufd have no way to recover them
>    and we will have memory leaks and worse during unmap
> 
> Since almost nothing can support this, and it is a useless thing to do,
> block it early in iommufd.
> 
> Cc: stable@kernel.org
> Fixes: aad37e71d5c4 ("iommufd: IOCTLs for the io_pagetable")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>

I also tried both patches with io-pgtable-arm and didn't see any
issue, since they tends to fix a corner case I think.

Nicolin


  reply	other threads:[~2024-08-23 16:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 14:45 [PATCH rc 0/2] Fix maps created without READ or WRITE Jason Gunthorpe
2024-08-22 14:45 ` [PATCH rc 1/2] iommufd: Do not allow creating areas " Jason Gunthorpe
2024-08-23 16:29   ` Nicolin Chen [this message]
2024-08-26  6:20   ` Tian, Kevin
2024-08-22 14:45 ` [PATCH rc 2/2] iommu: Do not return 0 from map_pages if it doesn't do anything Jason Gunthorpe
2024-08-23 16:18   ` Will Deacon
2024-08-26  6:20   ` Tian, Kevin
2024-08-26  7:16 ` [PATCH rc 0/2] Fix maps created without READ or WRITE Joerg Roedel

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=Zsi47Ek88/f42hDd@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=kevin.tian@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lixiao.yang@intel.com \
    --cc=marcan@marcan.st \
    --cc=mjrosato@linux.ibm.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=shuah@kernel.org \
    --cc=sven@svenpeter.dev \
    --cc=will.deacon@arm.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    --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