qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: den-plotnikov@yandex-team.ru, raphael.norwitz@nutanix.com,
	qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [PATCH 1/5] vhost-user-blk: Don't reconnect during initialisation
Date: Wed, 28 Apr 2021 21:37:32 +0200	[thread overview]
Message-ID: <1449ed8d-1334-a69b-ee83-ca3587f11bf9@redhat.com> (raw)
In-Reply-To: <20210422170221.285006-2-kwolf@redhat.com>

On 4/22/21 7:02 PM, Kevin Wolf wrote:
> This is a partial revert of commits 77542d43149 and bc79c87bcde.
> 
> Usually, an error during initialisation means that the configuration was
> wrong. Reconnecting won't make the error go away, but just turn the
> error condition into an endless loop. Avoid this and return errors
> again.
> 
> Additionally, calling vhost_user_blk_disconnect() from the chardev event
> handler could result in use-after-free because none of the
> initialisation code expects that the device could just go away in the

TIL initialisation wording.

> middle. So removing the call fixes crashes in several places.
> 
> For example, using a num-queues setting that is incompatible with the
> backend would result in a crash like this (dereferencing dev->opaque,
> which is already NULL):
> 
>  #0  0x0000555555d0a4bd in vhost_user_read_cb (source=0x5555568f4690, condition=(G_IO_IN | G_IO_HUP), opaque=0x7fffffffcbf0) at ../hw/virtio/vhost-user.c:313
>  #1  0x0000555555d950d3 in qio_channel_fd_source_dispatch (source=0x555557c3f750, callback=0x555555d0a478 <vhost_user_read_cb>, user_data=0x7fffffffcbf0) at ../io/channel-watch.c:84
>  #2  0x00007ffff7b32a9f in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
>  #3  0x00007ffff7b84a98 in g_main_context_iterate.constprop () at /lib64/libglib-2.0.so.0
>  #4  0x00007ffff7b32163 in g_main_loop_run () at /lib64/libglib-2.0.so.0
>  #5  0x0000555555d0a724 in vhost_user_read (dev=0x555557bc62f8, msg=0x7fffffffcc50) at ../hw/virtio/vhost-user.c:402
>  #6  0x0000555555d0ee6b in vhost_user_get_config (dev=0x555557bc62f8, config=0x555557bc62ac "", config_len=60) at ../hw/virtio/vhost-user.c:2133
>  #7  0x0000555555d56d46 in vhost_dev_get_config (hdev=0x555557bc62f8, config=0x555557bc62ac "", config_len=60) at ../hw/virtio/vhost.c:1566
>  #8  0x0000555555cdd150 in vhost_user_blk_device_realize (dev=0x555557bc60b0, errp=0x7fffffffcf90) at ../hw/block/vhost-user-blk.c:510
>  #9  0x0000555555d08f6d in virtio_device_realize (dev=0x555557bc60b0, errp=0x7fffffffcff0) at ../hw/virtio/virtio.c:3660
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  hw/block/vhost-user-blk.c | 54 ++++++++++-----------------------------
>  1 file changed, 13 insertions(+), 41 deletions(-)



  parent reply	other threads:[~2021-04-28 19:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 17:02 [PATCH 0/5] vhost-user-blk: Error handling fixes during initialistion Kevin Wolf
2021-04-22 17:02 ` [PATCH 1/5] vhost-user-blk: Don't reconnect during initialisation Kevin Wolf
2021-04-23  7:17   ` Denis Plotnikov
2021-04-28 16:52   ` Raphael Norwitz
2021-04-28 17:31     ` Kevin Wolf
2021-04-28 18:22       ` Raphael Norwitz
2021-04-28 19:37   ` Philippe Mathieu-Daudé [this message]
2021-04-29 12:48   ` Kevin Wolf
2021-04-29 16:53     ` Raphael Norwitz
2021-04-22 17:02 ` [PATCH 2/5] vhost-user-blk: Use Error more consistently Kevin Wolf
2021-04-28 18:08   ` Raphael Norwitz
2021-04-29  9:26     ` Kevin Wolf
2021-04-29 12:56       ` Raphael Norwitz
2021-04-22 17:02 ` [PATCH 3/5] vhost-user-blk: Get more feature flags from vhost device Kevin Wolf
2021-04-28 18:46   ` [PATCH 3/5] vhost-user-blk: Get more feature flags from vhost devicey Raphael Norwitz
2021-04-22 17:02 ` [PATCH 4/5] virtio: Fail if iommu_platform is requested, but unsupported Kevin Wolf
2021-04-28 19:24   ` Raphael Norwitz
2021-04-29  9:34     ` Kevin Wolf
2021-04-29 12:48       ` Raphael Norwitz
2021-04-22 17:02 ` [PATCH 5/5] vhost-user-blk: Check that num-queues is supported by backend Kevin Wolf
2021-04-28 20:16   ` Raphael Norwitz

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=1449ed8d-1334-a69b-ee83-ca3587f11bf9@redhat.com \
    --to=philmd@redhat.com \
    --cc=den-plotnikov@yandex-team.ru \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.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 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).