From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: pbonzini@redhat.com, crosthwaite.peter@gmail.com,
rth@twiddle.net, qemu-devel@nongnu.org,
Cornelia Huck <cornelia.huck@de.ibm.com>
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 [thread overview]
Message-ID: <e63339c3-e368-b5d8-a60f-69684bb5496a@redhat.com> (raw)
In-Reply-To: <20170330002612-mutt-send-email-mst@kernel.org>
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<cornelia.huck@de.ibm.com>
>> Cc: Paolo Bonzini<pbonzini@redhat.com>
>> Signed-off-by: Jason Wang<jasowang@redhat.com>
> 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.
Thanks
prev parent reply other threads:[~2017-03-30 5:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 6:12 [Qemu-devel] [PATCH] exec: don't return int64_t in address_space_cache_init() Jason Wang
2017-03-29 21:26 ` Michael S. Tsirkin
2017-03-30 5:59 ` Jason Wang [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=e63339c3-e368-b5d8-a60f-69684bb5496a@redhat.com \
--to=jasowang@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=crosthwaite.peter@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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;
as well as URLs for NNTP newsgroup(s).