* [PATCH v3 0/3] vsock/virtio: several fixes in the .probe() and .remove()
@ 2019-07-05 11:04 Stefano Garzarella
0 siblings, 0 replies; 4+ messages in thread
From: Stefano Garzarella @ 2019-07-05 11:04 UTC (permalink / raw)
To: netdev
Cc: kvm, Michael S. Tsirkin, linux-kernel, virtualization,
Stefan Hajnoczi, David S. Miller
During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock
before registering the driver", Stefan pointed out some possible issues
in the .probe() and .remove() callbacks of the virtio-vsock driver.
This series tries to solve these issues:
- Patch 1 adds RCU critical sections to avoid use-after-free of
'the_virtio_vsock' pointer.
- Patch 2 stops workers before to call vdev->config->reset(vdev) to
be sure that no one is accessing the device.
- Patch 3 moves the works flush at the end of the .remove() to avoid
use-after-free of 'vsock' object.
v3:
- Patch 1: use rcu_dereference_protected() to get the_virtio_vosck value in
the virtio_vsock_probe() [Jason]
v2: https://patchwork.kernel.org/cover/11022343/
v1: https://patchwork.kernel.org/cover/10964733/
Before this series the guest crashes in a few second. After this series the
test runs (~12h) without issues.
Tested on an SMP guest (-smp 4 -monitor tcp:127.0.0.1:1234,server,nowait)
with these scripts to stress the .probe()/.remove() path:
- guest
while true; do
cat /dev/urandom | nc-vsock -l 4321 > /dev/null &
cat /dev/urandom | nc-vsock -l 5321 > /dev/null &
cat /dev/urandom | nc-vsock -l 6321 > /dev/null &
cat /dev/urandom | nc-vsock -l 7321 > /dev/null &
wait
done
- host
while true; do
cat /dev/urandom | nc-vsock 3 4321 > /dev/null &
cat /dev/urandom | nc-vsock 3 5321 > /dev/null &
cat /dev/urandom | nc-vsock 3 6321 > /dev/null &
cat /dev/urandom | nc-vsock 3 7321 > /dev/null &
sleep 2
echo "device_del v1" | nc 127.0.0.1 1234
sleep 1
echo "device_add vhost-vsock-pci,id=v1,guest-cid=3" | nc 127.0.0.1 1234
sleep 1
done
Stefano Garzarella (3):
vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
vsock/virtio: stop workers during the .remove()
vsock/virtio: fix flush of works during the .remove()
net/vmw_vsock/virtio_transport.c | 134 ++++++++++++++++++++++++-------
1 file changed, 104 insertions(+), 30 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 0/3] vsock/virtio: several fixes in the .probe() and .remove()
2019-07-05 11:04 Stefano Garzarella
2019-07-08 22:35 ` David Miller
@ 2019-07-08 22:35 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2019-07-08 22:35 UTC (permalink / raw)
To: sgarzare
Cc: netdev, kvm, mst, linux-kernel, jasowang, virtualization, stefanha
From: Stefano Garzarella <sgarzare@redhat.com>
Date: Fri, 5 Jul 2019 13:04:51 +0200
> During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock
> before registering the driver", Stefan pointed out some possible issues
> in the .probe() and .remove() callbacks of the virtio-vsock driver.
...
Series applied to net-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 0/3] vsock/virtio: several fixes in the .probe() and .remove()
2019-07-05 11:04 Stefano Garzarella
@ 2019-07-08 22:35 ` David Miller
2019-07-08 22:35 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2019-07-08 22:35 UTC (permalink / raw)
To: sgarzare; +Cc: kvm, mst, netdev, linux-kernel, virtualization, stefanha
From: Stefano Garzarella <sgarzare@redhat.com>
Date: Fri, 5 Jul 2019 13:04:51 +0200
> During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock
> before registering the driver", Stefan pointed out some possible issues
> in the .probe() and .remove() callbacks of the virtio-vsock driver.
...
Series applied to net-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 0/3] vsock/virtio: several fixes in the .probe() and .remove()
@ 2019-07-05 11:04 Stefano Garzarella
2019-07-08 22:35 ` David Miller
2019-07-08 22:35 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Stefano Garzarella @ 2019-07-05 11:04 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, kvm, Michael S. Tsirkin, linux-kernel,
Jason Wang, virtualization, Stefan Hajnoczi
During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock
before registering the driver", Stefan pointed out some possible issues
in the .probe() and .remove() callbacks of the virtio-vsock driver.
This series tries to solve these issues:
- Patch 1 adds RCU critical sections to avoid use-after-free of
'the_virtio_vsock' pointer.
- Patch 2 stops workers before to call vdev->config->reset(vdev) to
be sure that no one is accessing the device.
- Patch 3 moves the works flush at the end of the .remove() to avoid
use-after-free of 'vsock' object.
v3:
- Patch 1: use rcu_dereference_protected() to get the_virtio_vosck value in
the virtio_vsock_probe() [Jason]
v2: https://patchwork.kernel.org/cover/11022343/
v1: https://patchwork.kernel.org/cover/10964733/
Before this series the guest crashes in a few second. After this series the
test runs (~12h) without issues.
Tested on an SMP guest (-smp 4 -monitor tcp:127.0.0.1:1234,server,nowait)
with these scripts to stress the .probe()/.remove() path:
- guest
while true; do
cat /dev/urandom | nc-vsock -l 4321 > /dev/null &
cat /dev/urandom | nc-vsock -l 5321 > /dev/null &
cat /dev/urandom | nc-vsock -l 6321 > /dev/null &
cat /dev/urandom | nc-vsock -l 7321 > /dev/null &
wait
done
- host
while true; do
cat /dev/urandom | nc-vsock 3 4321 > /dev/null &
cat /dev/urandom | nc-vsock 3 5321 > /dev/null &
cat /dev/urandom | nc-vsock 3 6321 > /dev/null &
cat /dev/urandom | nc-vsock 3 7321 > /dev/null &
sleep 2
echo "device_del v1" | nc 127.0.0.1 1234
sleep 1
echo "device_add vhost-vsock-pci,id=v1,guest-cid=3" | nc 127.0.0.1 1234
sleep 1
done
Stefano Garzarella (3):
vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
vsock/virtio: stop workers during the .remove()
vsock/virtio: fix flush of works during the .remove()
net/vmw_vsock/virtio_transport.c | 134 ++++++++++++++++++++++++-------
1 file changed, 104 insertions(+), 30 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-08 22:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05 11:04 [PATCH v3 0/3] vsock/virtio: several fixes in the .probe() and .remove() Stefano Garzarella
2019-07-05 11:04 Stefano Garzarella
2019-07-08 22:35 ` David Miller
2019-07-08 22:35 ` David Miller
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.