[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <665925d2-d6d5-218f-15f8-c6c5abaaba40@linux.intel.com>
Date: Wed, 2 Jun 2021 19:03:47 -0700
From: Andi Kleen <ak@...ux.intel.com>
To: Konrad Rzeszutek Wilk <konrad@...nok.org>
Cc: mst@...hat.com, jasowang@...hat.com,
virtualization@...ts.linux-foundation.org, hch@....de,
m.szyprowski@...sung.com, robin.murphy@....com,
iommu@...ts.linux-foundation.org, x86@...nel.org,
sathyanarayanan.kuppuswamy@...ux.intel.com, jpoimboe@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 5/8] dma: Use size for swiotlb boundary checks
On 6/2/2021 6:48 PM, Konrad Rzeszutek Wilk wrote:
> On Wed, Jun 02, 2021 at 05:41:30PM -0700, Andi Kleen wrote:
>> swiotlb currently only uses the start address of a DMA to check if something
>> is in the swiotlb or not. But with virtio and untrusted hosts the host
>> could give some DMA mapping that crosses the swiotlb boundaries,
>> potentially leaking or corrupting data. Add size checks to all the swiotlb
>> checks and reject any DMAs that cross the swiotlb buffer boundaries.
> I seem to be only CC-ed on this and #7, so please bear with me.
You weren't cc'ed originally so if you get partial emails it must be
through some list.
>
> But could you explain to me why please:
>
> commit daf9514fd5eb098d7d6f3a1247cb8cc48fc94155 (swiotlb/stable/for-linus-5.12)
> Author: Martin Radev <martin.b.radev@...il.com>
> Date: Tue Jan 12 16:07:29 2021 +0100
>
> swiotlb: Validate bounce size in the sync/unmap path
>
> does not solve the problem as well?
Thanks. I missed that patch, race condition.
One major difference of my patch is that it supports an error return,
which allows virtio to error out. This is important in virtio because
otherwise you'll end up with uninitialized memory on the target without
any indication. This uninitialized memory could be an potential attack
vector on the guest memory, e.g. if the attacker finds some way to echo
it out again.
But the error return could be added to your infrastructure too and what
would make this patch much shorter. I'll take a look at that.
-Andi
Powered by blists - more mailing lists