From: Wen Congyang <wency@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>, peter.huangpeng@huawei.com
Subject: Re: [Qemu-devel] [PATCH] vhost: fix log base address
Date: Fri, 17 Apr 2015 12:02:38 +0800 [thread overview]
Message-ID: <553085DE.5080201@cn.fujitsu.com> (raw)
In-Reply-To: <5530291E.8040606@redhat.com>
On 04/17/2015 05:26 AM, Paolo Bonzini wrote:
>
>
> On 15/04/2015 11:56, zhanghailiang wrote:
>> On 2015/4/15 17:37, Michael S. Tsirkin wrote:
>>> VHOST_SET_LOG_BASE got an incorrect address, causing
>>> migration errors and potentially even memory corruption.
>>>
>>> Cc: Peter Maydell <peter.maydell@linaro.org>
>>> Reported-by: Wen Congyang <wency@cn.fujitsu.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>> ---
>>>
>>> Could you please confirm this fixes the problem for you?
>>>
>>> hw/virtio/vhost.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>>> index 8dd2f59..02c5604 100644
>>> --- a/hw/virtio/vhost.c
>>> +++ b/hw/virtio/vhost.c
>>> @@ -1016,10 +1016,13 @@ int vhost_dev_start(struct vhost_dev *hdev,
>>> VirtIODevice *vdev)
>>> }
>>>
>>> if (hdev->log_enabled) {
>>> + uint64_t log_base;
>>> +
>>> hdev->log_size = vhost_get_log_size(hdev);
>>> hdev->log = hdev->log_size ?
>>> g_malloc0(hdev->log_size * sizeof *hdev->log) : NULL;
>>> - r = hdev->vhost_ops->vhost_call(hdev, VHOST_SET_LOG_BASE,
>>> hdev->log);
>>> + log_base = (uint64_t)(unsigned long)log_base;
>> ^^^^^^^^
>>
>> s/log_base/hdev->log ?
>
> Also s/unsigned long/uintptr_t/ please. The subsequent cast to uint64_t
> is not necessary.
Should we also update vhost_dev_log_resize()?
Thanks
Wen Congyang
>
> Paolo
>
>>> + r = hdev->vhost_ops->vhost_call(hdev, VHOST_SET_LOG_BASE,
>>> &log_base);
>>> if (r < 0) {
>>> r = -errno;
>>> goto fail_log;
>>>
>>
>>
>>
>>
>
>
next prev parent reply other threads:[~2015-04-17 3:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 9:37 [PATCH] vhost: fix log base address Michael S. Tsirkin
2015-04-15 9:37 ` [Qemu-devel] " Michael S. Tsirkin
2015-04-15 9:56 ` zhanghailiang
2015-04-15 10:08 ` Wen Congyang
2015-04-16 21:26 ` Paolo Bonzini
2015-04-17 4:02 ` Wen Congyang [this message]
2015-04-17 14:40 ` Peter Maydell
2015-04-17 14:56 ` Michael S. Tsirkin
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=553085DE.5080201@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.