mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Shukai Ni <shukai.ni@kuleuven.be>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Halil Pasic <pasic@linux.ibm.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Elena Reshetova <elena.reshetova@intel.com>,
	Carlos Bilbao <carlos.bilbao@kernel.org>,
	linux-coco@lists.linux.dev, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Subject: Re: [PATCH] swiotlb: clear read bounce buffers on confidential guests
Date: Tue, 24 Nov 2026 17:11:18 +0100	[thread overview]
Message-ID: <874dc793-7287-4c23-b1b7-0417fc43b7b9@samsung.com> (raw)
In-Reply-To: <20261124153615.GA114530@ziepe.ca>

On 24.11.2026 16:36, Jason Gunthorpe wrote:
> On Tue, Nov 24, 2026 at 04:17:20PM +0100, Marek Szyprowski wrote:
>> CCed Jason and Aneesh.
>>
>> On 23.11.2026 21:53, Shukai Ni wrote:
>>> On confidential guests (AMD SEV, Intel TDX) all device DMA is bounced
>>> through swiotlb, whose pool is shared with and readable by the untrusted
>>> host. swiotlb_tbl_map_single() copies the destination buffer's current
>>> contents into the bounce buffer at map time even for DMA_FROM_DEVICE. For
>>> a reused read buffer that still holds private data, the host can read
>>> that data from the bounce buffer before the device overwrites it.
>>>
>>> For DMA_FROM_DEVICE into a host-shared pool, zero the bounce buffer
>>> instead. Zeroing rather than skipping the copy keeps a short read from
>>> returning a previous transfer's data.
>>>
>>> Fixes: ddbd89deb7d3 ("swiotlb: fix info leak with DMA_FROM_DEVICE")
>>> Cc: stable@vger.kernel.org
>>> Co-developed-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
>>> Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
>>> Signed-off-by: Shukai Ni <shukai.ni@kuleuven.be>
>>
>> I'm not sure if DMA-mapping or SWIOTLB is the right place for such fixups.
>>
>> Drivers should be aware that doing DMA from unsecure device to the given
>> secure page might reveal its content to the host or other parties and
>> prepare for that (like zeroing that page).
> I think given the semantics we have to support partial write we don't
> have a choice but to continue them as it is the DMA API.
>
> The driver would have to opt out of partial write support somehow to
> trigger this, and in that case it is more of an optimization and
> shouldn't be linked to CC.

This has been already tried some time ago:

https://lore.kernel.org/all/20250115194659.618438-1-florian.fainelli@broadcom.com/

It looks that something similar, but with zeroing the swiotlb buffer instead

of skipping the copy would make some sense.


> I'm curious if there is a real issue here with a definitive issue on a
> driver or it is just speculation?
>
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


      reply	other threads:[~2026-11-24 16:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261123205317eucas1p2f96032281e0f5e9f17acc7ec343acced@eucas1p2.samsung.com>
2026-11-23 20:53 ` Shukai Ni
2026-11-23 22:18   ` Edgecombe, Rick P
2026-11-23 22:56     ` Shukai Ni
2026-11-24 16:13       ` Robin Murphy
2026-11-24 15:17   ` Marek Szyprowski
2026-11-24 15:36     ` Jason Gunthorpe
2026-11-24 16:11       ` Marek Szyprowski [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=874dc793-7287-4c23-b1b7-0417fc43b7b9@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=carlos.bilbao@kernel.org \
    --cc=elena.reshetova@intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=jo.vanbulck@cs.kuleuven.be \
    --cc=joro@8bytes.org \
    --cc=kas@kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pasic@linux.ibm.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=shukai.ni@kuleuven.be \
    --cc=stable@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®