Linux IOMMU Development
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Yi Liu <yi.l.liu@intel.com>,
	Christoph Hellwig <hch@infradead.org>,
	David Woodhouse <dwmw2@infradead.org>
Cc: baolu.lu@linux.intel.com, iommu@lists.linux.dev
Subject: Re: lack of permission checking with intel-iommu?
Date: Tue, 2 Jul 2024 17:07:22 +0800	[thread overview]
Message-ID: <09af1efa-a9b7-4db1-aa14-da22aeafe7e7@linux.intel.com> (raw)
In-Reply-To: <fb388a2b-9ffc-42c5-893c-0c620e6977fc@intel.com>

On 2024/7/2 16:47, Yi Liu wrote:
>>>>
>>>> we've recently had an interesting case where a device unexpectedly
>>>> modified a dma buffer passed to it.  On AMD systems this caused iommu
>>>> faults because the buffer was mapped read only (DMA_FROM_DEVICE), but
>>>> on an Intel system everything worked fine as the IOMMU did not trip up
>>>> on the device writes to that buffer.  Any idea why that could sneak
>>>> through?
>>> Sorry if this was confusing, the permission checking is of course about
>>> the device reading from a buffer mapped read-only for the device
>>> (as that is what DMA_FROM_DEVICE is), which on intel still allows it
>>> to read.
>>
>> Is it about IOMMU blocking "device reading from buffer" or "device
>> writing to buffer"?
>>
>> The intel iommu driver might use first-stage translation for kernel DMA.
>> It seems not to block the "device reading from buffer" if I remember it
>> correctly.
> 
> does the current kernel use the first-stage page table by default?

Use first-stage page table for kernel DMA by default.

Best regards,
baolu

      reply	other threads:[~2024-07-02  9:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02  7:46 lack of permission checking with intel-iommu? Christoph Hellwig
2024-07-02  8:02 ` Christoph Hellwig
2024-07-02  8:22   ` Baolu Lu
2024-07-02  8:25     ` Christoph Hellwig
2024-07-02  9:12       ` Baolu Lu
2024-07-02 11:42         ` Christoph Hellwig
2024-07-03  0:56         ` Tian, Kevin
2024-07-03  2:28           ` Baolu Lu
2024-07-02  8:47     ` Yi Liu
2024-07-02  9:07       ` Baolu Lu [this message]

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=09af1efa-a9b7-4db1-aa14-da22aeafe7e7@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=yi.l.liu@intel.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