lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 3 Dec 2021 14:32:55 +0000
From:   Suzuki K Poulose <suzuki.poulose@....com>
To:     Marc Zyngier <maz@...nel.org>
Cc:     linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        will@...nel.org, jasowang@...hat.com,
        virtualization@...ts.linux-foundation.org,
        Joerg Roedel <jroedel@...e.de>,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Christoph Hellwig <hch@....de>,
        "Michael S . Tsirkin" <mst@...hat.com>,
        Robin Murphy <robin.murphy@....com>,
        Steven Price <steven.price@....com>
Subject: Re: [PATCH] virtio_vring: Fix maximum DMA mapping size computation

On 03/12/2021 12:26, Marc Zyngier wrote:
> On 2021-12-03 12:16, Suzuki K Poulose wrote:
>> The virtio vring is a bit messy about the DMA allocations. We
>> use the parent device for any DMA alloc/free. However, we use the
>> child device for calculating the maximum size mapped by the DMA API
>> for the device. This leads to issues where the max size is set to
>> SIZE_MAX, and if the virtio device (e.g, virtio-blk) is bound to
>> swiotlb (e.g., via restricted-dma pool), we end up trying to allocate
>> larger chunks of memory, which are never satisfied by the swiotlb and
>> eventually fails.
>>
>> Fix this by using the parent device (just like all the other
>> DMA API calls) for the max mapping size.
>>
>> Fixes: e6d6dd6c875e ("virtio: Introduce virtio_max_dma_size()")
>> Cc: Joerg Roedel <jroedel@...e.de>
>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
>> Cc: Christoph Hellwig <hch@....de>
>> Cc: Michael S. Tsirkin <mst@...hat.com>
>> Cc: Robin Murphy <robin.murphy@....com>
>> Signed-off-by: Steven Price <steven.price@....com>
>> Co-developed-by: Suzuki K Poulose <suzuki.poulose@....com>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
>> ---
>>  drivers/virtio/virtio_ring.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
>> index 6d2614e34470..028b05d44546 100644
>> --- a/drivers/virtio/virtio_ring.c
>> +++ b/drivers/virtio/virtio_ring.c
>> @@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device 
>> *vdev)
>>      size_t max_segment_size = SIZE_MAX;
>>
>>      if (vring_use_dma_api(vdev))
>> -        max_segment_size = dma_max_mapping_size(&vdev->dev);
>> +        max_segment_size = dma_max_mapping_size(vdev->dev.parent);
>>
>>      return max_segment_size;
>>  }
> 
> Ah, it looks like we all hit the same thing[1] at the same time!

Aha ! Thanks for the pointer Marc.

Suzuki

> 
>          M.
> 
> [1] https://lore.kernel.org/r/20211201112018.25276-1-will@kernel.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ