Skip to content
  • Stefan Hajnoczi's avatar
    b7c1bd9d
    Revert "vhost-blk: set features before setting inflight feature" · b7c1bd9d
    Stefan Hajnoczi authored
    
    
    This reverts commit adb29c02.
    
    The commit broke -device vhost-user-blk-pci because the
    vhost_dev_prepare_inflight() function it introduced segfaults in
    vhost_dev_set_features() when attempting to access struct vhost_dev's
    vdev pointer before it has been assigned.
    
    To reproduce the segfault simply launch a vhost-user-blk device with the
    contrib vhost-user-blk device backend:
    
      $ build/contrib/vhost-user-blk/vhost-user-blk -s /tmp/vhost-user-blk.sock -r -b /var/tmp/foo.img
      $ build/qemu-system-x86_64 \
            -device vhost-user-blk-pci,id=drv0,chardev=char1,addr=4.0 \
            -object memory-backend-memfd,id=mem,size=1G,share=on \
            -M memory-backend=mem,accel=kvm \
            -chardev socket,id=char1,path=/tmp/vhost-user-blk.sock
      Segmentation fault (core dumped)
    
    Cc: Jin Yu <jin.yu@intel.com>
    Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20201102165709.232180-1-stefanha@redhat.com>
    Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    b7c1bd9d
    Revert "vhost-blk: set features before setting inflight feature"
    Stefan Hajnoczi authored
    
    
    This reverts commit adb29c02.
    
    The commit broke -device vhost-user-blk-pci because the
    vhost_dev_prepare_inflight() function it introduced segfaults in
    vhost_dev_set_features() when attempting to access struct vhost_dev's
    vdev pointer before it has been assigned.
    
    To reproduce the segfault simply launch a vhost-user-blk device with the
    contrib vhost-user-blk device backend:
    
      $ build/contrib/vhost-user-blk/vhost-user-blk -s /tmp/vhost-user-blk.sock -r -b /var/tmp/foo.img
      $ build/qemu-system-x86_64 \
            -device vhost-user-blk-pci,id=drv0,chardev=char1,addr=4.0 \
            -object memory-backend-memfd,id=mem,size=1G,share=on \
            -M memory-backend=mem,accel=kvm \
            -chardev socket,id=char1,path=/tmp/vhost-user-blk.sock
      Segmentation fault (core dumped)
    
    Cc: Jin Yu <jin.yu@intel.com>
    Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20201102165709.232180-1-stefanha@redhat.com>
    Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Loading