search for: shutdown_mask

Displaying 20 results from an estimated 50 matches for "shutdown_mask".

2020 May 31
0
[PATCH v3] virtio_vsock: Fix race condition in virtio_transport_recv_pkt
...===== > __sock_release virtio_transport_recv_pkt > __vsock_release vsock_find_bound_socket (found sk) > lock_sock_nested > vsock_remove_sock > sock_orphan > sk_set_socket(sk, NULL) > sk->sk_shutdown = SHUTDOWN_MASK > ... > release_sock > lock_sock > virtio_transport_recv_connecting > sk->sk_socket->state (panic!) > > The root cause is that vsock_find_bound_soc...
2020 May 29
0
[PATCH v2] virtio_vsock: Fix race condition in virtio_transport_recv_pkt
...===== > __sock_release virtio_transport_recv_pkt > __vsock_release vsock_find_bound_socket (found) > lock_sock_nested > vsock_remove_sock > sock_orphan > sk_set_socket(sk, NULL) Here we can add: sk->sk_shutdown = SHUTDOWN_MASK; > ... > release_sock > lock_sock > virtio_transport_recv_connecting > sk->sk_socket->state (panic) > > The root cause is that vsock_find_bound_socket can'...
2019 Oct 11
6
[PATCH net 0/2] vsock: don't allow half-closed socket in the host transports
We are implementing a test suite for the VSOCK sockets and we discovered that vmci_transport never allowed half-closed socket on the host side. As Jorgen explained [1] this is due to the implementation of VMCI. Since we want to have the same behaviour across all transports, this series adds a section in the "Implementation notes" to exaplain this behaviour, and changes the
2019 Oct 11
6
[PATCH net 0/2] vsock: don't allow half-closed socket in the host transports
We are implementing a test suite for the VSOCK sockets and we discovered that vmci_transport never allowed half-closed socket on the host side. As Jorgen explained [1] this is due to the implementation of VMCI. Since we want to have the same behaviour across all transports, this series adds a section in the "Implementation notes" to exaplain this behaviour, and changes the
2016 Dec 07
1
[PATCH] vhost-vsock: fix orphan connection reset
...k.c +++ b/drivers/vhost/vsock.c @@ -506,7 +506,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk) * executing. */ - if (!vhost_vsock_get(vsk->local_addr.svm_cid)) { + if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) { sock_set_flag(sk, SOCK_DONE); vsk->peer_shutdown = SHUTDOWN_MASK; sk->sk_state = SS_UNCONNECTED; -- 2.7.4
2016 Dec 08
1
[PATCH-RESEND] vhost-vsock: fix orphan connection reset
...k.c +++ b/drivers/vhost/vsock.c @@ -506,7 +506,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk) * executing. */ - if (!vhost_vsock_get(vsk->local_addr.svm_cid)) { + if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) { sock_set_flag(sk, SOCK_DONE); vsk->peer_shutdown = SHUTDOWN_MASK; sk->sk_state = SS_UNCONNECTED; -- 2.7.4
2019 Oct 11
0
[PATCH net 2/2] vhost/vsock: don't allow half-closed socket in the host
...recv() on the host side returns EOF when the guest closes a + * connection, also if some data is still in the receive queue. + * + * In order to provide the same behaviour, we always return 0 + * (no data available) if the peer (guest) closed the connection. + */ + if (vsk->peer_shutdown == SHUTDOWN_MASK) + return 0; + + return virtio_transport_stream_has_data(vsk); +} + /* Callers that dereference the return value must hold vhost_vsock_mutex or the * RCU read lock. */ @@ -804,7 +819,7 @@ static struct virtio_transport vhost_transport = { .stream_enqueue = virtio_transport_stre...
2019 Nov 08
1
[PATCH] vsock/virtio: fix sock refcnt holding during the shutdown
...vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -947,9 +947,11 @@ virtio_transport_recv_connected(struct sock *sk, if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SHUTDOWN_SEND) vsk->peer_shutdown |= SEND_SHUTDOWN; if (vsk->peer_shutdown == SHUTDOWN_MASK && - vsock_stream_has_data(vsk) <= 0) { - sock_set_flag(sk, SOCK_DONE); - sk->sk_state = TCP_CLOSING; + vsock_stream_has_data(vsk) <= 0 && + !sock_flag(sk, SOCK_DONE)) { + (void)virtio_transport_reset(vsk, NULL); + + virtio_transport_do_close(vsk, tru...
2016 Dec 07
1
[PATCH] vhost-vsock: fix orphan connection reset
...k.c +++ b/drivers/vhost/vsock.c @@ -506,7 +506,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk) * executing. */ - if (!vhost_vsock_get(vsk->local_addr.svm_cid)) { + if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) { sock_set_flag(sk, SOCK_DONE); vsk->peer_shutdown = SHUTDOWN_MASK; sk->sk_state = SS_UNCONNECTED; -- 2.7.4
2016 Dec 08
1
[PATCH-RESEND] vhost-vsock: fix orphan connection reset
...k.c +++ b/drivers/vhost/vsock.c @@ -506,7 +506,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk) * executing. */ - if (!vhost_vsock_get(vsk->local_addr.svm_cid)) { + if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) { sock_set_flag(sk, SOCK_DONE); vsk->peer_shutdown = SHUTDOWN_MASK; sk->sk_state = SS_UNCONNECTED; -- 2.7.4
2020 May 29
0
[PATCH] virtio_vsock: Fix race condition in virtio_transport_recv_pkt
...t; + } > + spin_unlock_bh(&vsock_table_lock); > + As an a simpler alternative, can we check the sk_shutdown or the socket state without check again both bound and connected tables? This is a data path, so we should take it faster. I mean something like this: if (sk->sk_shutdown == SHUTDOWN_MASK) { ... } or if (sock_flag(sk, SOCK_DEAD)) { ... } I prefer the first option, but I think also the second option should work. Thanks, Stefano > /* Update CID in case it has changed after a transport reset event */ > vsk->local_addr.svm_cid = dst.svm_cid; > > -- >...
2019 Sep 27
0
[PATCH net v2] vsock: Fix a lockdep warning in __vsock_release()
...sk) { struct sk_buff *skb; @@ -650,7 +650,7 @@ static void __vsock_release(struct sock *sk) transport->release(vsk); - lock_sock(sk); + lock_sock_nested(sk, level); sock_orphan(sk); sk->sk_shutdown = SHUTDOWN_MASK; @@ -659,7 +659,7 @@ static void __vsock_release(struct sock *sk) /* Clean up any sockets that never were accepted. */ while ((pending = vsock_dequeue_accept(sk)) != NULL) { - __vsock_release(pending); + __vsock_release(p...
2019 Oct 11
1
[PATCH net 2/2] vhost/vsock: don't allow half-closed socket in the host
...s EOF when the guest closes a > + * connection, also if some data is still in the receive queue. > + * > + * In order to provide the same behaviour, we always return 0 > + * (no data available) if the peer (guest) closed the connection. > + */ > + if (vsk->peer_shutdown == SHUTDOWN_MASK) > + return 0; > + > + return virtio_transport_stream_has_data(vsk); > +} > + > /* Callers that dereference the return value must hold vhost_vsock_mutex or the > * RCU read lock. > */ > @@ -804,7 +819,7 @@ static struct virtio_transport vhost_transport = { > &g...
2016 Jul 28
6
[RFC v6 0/6] Add virtio transport for AF_VSOCK
This series is based on v4.7. This RFC is the implementation for the new VIRTIO Socket device. It is developed in parallel with the VIRTIO device specification and proves the design. Once the specification has been accepted I will send a non-RFC version of this patch series. v6: * Add VHOST_VSOCK_SET_RUNNING ioctl to start/stop vhost cleanly * Add graceful shutdown to avoid port reuse while
2016 Jul 28
6
[RFC v6 0/6] Add virtio transport for AF_VSOCK
This series is based on v4.7. This RFC is the implementation for the new VIRTIO Socket device. It is developed in parallel with the VIRTIO device specification and proves the design. Once the specification has been accepted I will send a non-RFC version of this patch series. v6: * Add VHOST_VSOCK_SET_RUNNING ioctl to start/stop vhost cleanly * Add graceful shutdown to avoid port reuse while
2019 Oct 01
0
[PATCH net v3] vsock: Fix a lockdep warning in __vsock_release()
...gt; + * version to avoid the warning "possible recursive locking > + * detected". When "level" is 0, lock_sock_nested(sk, level) > + * is the same as lock_sock(sk). > + */ > + lock_sock_nested(sk, level); > sock_orphan(sk); > sk->sk_shutdown = SHUTDOWN_MASK; > > @@ -659,7 +667,7 @@ static void __vsock_release(struct sock *sk) > > /* Clean up any sockets that never were accepted. */ > while ((pending = vsock_dequeue_accept(sk)) != NULL) { > - __vsock_release(pending); > + __vsock_release(pending, SINGLE_DEPTH_NESTING)...
2019 Sep 26
0
[PATCH net v2] vsock: Fix a lockdep warning in __vsock_release()
...sock() calls lock_sock_nested(sk, 0), could we use directly lock_sock_nested(sk, level) with level = 0 in vsock_release() and level = SINGLE_DEPTH_NESTING here in the while loop? > + else > + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); > sock_orphan(sk); > sk->sk_shutdown = SHUTDOWN_MASK; > > @@ -659,7 +670,7 @@ static void __vsock_release(struct sock *sk) > > /* Clean up any sockets that never were accepted. */ > while ((pending = vsock_dequeue_accept(sk)) != NULL) { > - __vsock_release(pending); > + __vsock_release(pending, 2); > sock_put...
2015 Dec 09
0
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...nsport_release(struct vsock_sock *vsk) +{ + struct sock *sk = &vsk->sk; + + pr_debug("%s: vsk=%p\n", __func__, vsk); + + /* Tell other side to terminate connection */ + if (sk->sk_type == SOCK_STREAM && sk->sk_state == SS_CONNECTED) { + virtio_transport_shutdown(vsk, SHUTDOWN_MASK); + } +} +EXPORT_SYMBOL_GPL(virtio_transport_release); + +int +virtio_transport_dgram_enqueue(struct vsock_sock *vsk, + struct sockaddr_vm *remote_addr, + struct msghdr *msg, + size_t dgram_len) +{ + return -EOPNOTSUPP; +} +EXPORT_SYMBOL_GPL(virtio_transport_dgram_enqueue...
2015 Dec 10
1
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...gt; +{ > + struct sock *sk = &vsk->sk; > + > + pr_debug("%s: vsk=%p\n", __func__, vsk); > + > + /* Tell other side to terminate connection */ > + if (sk->sk_type == SOCK_STREAM && sk->sk_state == SS_CONNECTED) { > + virtio_transport_shutdown(vsk, SHUTDOWN_MASK); > + } > +} > +EXPORT_SYMBOL_GPL(virtio_transport_release); > + > +int > +virtio_transport_dgram_enqueue(struct vsock_sock *vsk, > + struct sockaddr_vm *remote_addr, > + struct msghdr *msg, > + size_t dgram_len) > +{ > + return -EOPNOTSUP...
2015 Dec 10
1
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...gt; +{ > + struct sock *sk = &vsk->sk; > + > + pr_debug("%s: vsk=%p\n", __func__, vsk); > + > + /* Tell other side to terminate connection */ > + if (sk->sk_type == SOCK_STREAM && sk->sk_state == SS_CONNECTED) { > + virtio_transport_shutdown(vsk, SHUTDOWN_MASK); > + } > +} > +EXPORT_SYMBOL_GPL(virtio_transport_release); > + > +int > +virtio_transport_dgram_enqueue(struct vsock_sock *vsk, > + struct sockaddr_vm *remote_addr, > + struct msghdr *msg, > + size_t dgram_len) > +{ > + return -EOPNOTSUP...