[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] exec: don't return int64_t in address_space_cac

From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH] exec: don't return int64_t in address_space_cache_init()
Date: Thu, 30 Mar 2017 13:59:33 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 2017年03月30日 05:26, Michael S. Tsirkin wrote:
On Wed, Mar 29, 2017 at 02:12:50PM +0800, Jason Wang wrote:
We return int64_t as the length of region cache but accept hwaddr as
the required length. This is wrong and may confuse the caller since
the it can lead comparison between signed and unsigned types. The
caller can not catch the failure in this case. Fixing this by
returning hwaddr and return zero on failure.

Fixes: 5eba0404b9829 ("virtio: use MemoryRegionCache to access descriptors")
Fixes: e45da65322386 ("virtio: validate address space cache during init")
Cc: Cornelia Huck<address@hidden>
Cc: Paolo Bonzini<address@hidden>
Signed-off-by: Jason Wang<address@hidden>
Can you be more specific about the symptoms this fixes in the
commit log?
E.g. "This actually triggers on XYZ when using ABC".

I want do this, but in fact this was triggered by a bug of qemu (see the thread of iommu reset vs region cache).

In that case, when used map fails, then check

     if (len < size) {
        virtio_error(vdev, "Cannot map used");
        goto err_used;

can not catch the -EFAULT, since len is converted to unsigned.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]