Displaying 20 results from an estimated 92 matches for "sk_vsock".
Did you mean:
af_vsock
2019 Nov 28
5
[RFC PATCH 0/3] vsock: support network namespace
Hi,
now that we have multi-transport upstream, I started to take a look to
support network namespace (netns) in vsock.
As we partially discussed in the multi-transport proposal [1], it could
be nice to support network namespace in vsock to reach the following
goals:
- isolate host applications from guest applications using the same ports
with CID_ANY
- assign the same CID of VMs running in
2019 Nov 28
5
[RFC PATCH 0/3] vsock: support network namespace
Hi,
now that we have multi-transport upstream, I started to take a look to
support network namespace (netns) in vsock.
As we partially discussed in the multi-transport proposal [1], it could
be nice to support network namespace in vsock to reach the following
goals:
- isolate host applications from guest applications using the same ports
with CID_ANY
- assign the same CID of VMs running in
2019 Sep 27
0
[RFC PATCH 13/13] vsock: fix bind() behaviour taking care of CID
...r)
{
struct vsock_sock *vsk;
- list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table)
- if (addr->svm_port == vsk->local_addr.svm_port)
+ list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table) {
+ if (vsock_addr_equals_addr(addr, &vsk->local_addr))
return sk_vsock(vsk);
+ if (addr->svm_port == vsk->local_addr.svm_port &&
+ (vsk->local_addr.svm_cid == VMADDR_CID_ANY ||
+ addr->svm_cid == VMADDR_CID_ANY))
+ return sk_vsock(vsk);
+ }
+
return NULL;
}
--
2.21.0
2019 Oct 23
0
[PATCH net-next 14/14] vsock: fix bind() behaviour taking care of CID
...r)
{
struct vsock_sock *vsk;
- list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table)
- if (addr->svm_port == vsk->local_addr.svm_port)
+ list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table) {
+ if (vsock_addr_equals_addr(addr, &vsk->local_addr))
return sk_vsock(vsk);
+ if (addr->svm_port == vsk->local_addr.svm_port &&
+ (vsk->local_addr.svm_cid == VMADDR_CID_ANY ||
+ addr->svm_cid == VMADDR_CID_ANY))
+ return sk_vsock(vsk);
+ }
+
return NULL;
}
--
2.21.0
2016 Dec 08
2
[PATCH v3 4/4] vsock: cancel packets when failing to connect
...{
+ if (!transport->cancel_pkt)
+ return -EOPNOTSUPP;
+
+ return transport->cancel_pkt(vsk);
+}
+
static void vsock_connect_timeout(struct work_struct *work)
{
struct sock *sk;
struct vsock_sock *vsk;
+ int cancel = 0;
vsk = container_of(work, struct vsock_sock, dwork.work);
sk = sk_vsock(vsk);
@@ -1115,8 +1124,11 @@ static void vsock_connect_timeout(struct work_struct *work)
sk->sk_state = SS_UNCONNECTED;
sk->sk_err = ETIMEDOUT;
sk->sk_error_report(sk);
+ cancel = 1;
}
release_sock(sk);
+ if (cancel)
+ vsock_transport_cancel_pkt(vsk);
sock_put(sk);
}
@@...
2016 Dec 08
2
[PATCH v3 4/4] vsock: cancel packets when failing to connect
...{
+ if (!transport->cancel_pkt)
+ return -EOPNOTSUPP;
+
+ return transport->cancel_pkt(vsk);
+}
+
static void vsock_connect_timeout(struct work_struct *work)
{
struct sock *sk;
struct vsock_sock *vsk;
+ int cancel = 0;
vsk = container_of(work, struct vsock_sock, dwork.work);
sk = sk_vsock(vsk);
@@ -1115,8 +1124,11 @@ static void vsock_connect_timeout(struct work_struct *work)
sk->sk_state = SS_UNCONNECTED;
sk->sk_err = ETIMEDOUT;
sk->sk_error_report(sk);
+ cancel = 1;
}
release_sock(sk);
+ if (cancel)
+ vsock_transport_cancel_pkt(vsk);
sock_put(sk);
}
@@...
2019 Oct 23
2
[PATCH net-next 11/14] vsock: add multi-transports support
...ill use host->guest transport
> + * - remote CID <= VMADDR_CID_HOST will use guest->host transport
> + */
> +int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
> +{
> + const struct vsock_transport *new_transport;
> + struct sock *sk = sk_vsock(vsk);
> +
> + switch (sk->sk_type) {
> + case SOCK_DGRAM:
> + new_transport = transport_dgram;
> + break;
> + case SOCK_STREAM:
> + if (vsk->remote_addr.svm_cid > VMADDR_CID_HOST)
> +...
2019 Oct 23
2
[PATCH net-next 11/14] vsock: add multi-transports support
...ill use host->guest transport
> + * - remote CID <= VMADDR_CID_HOST will use guest->host transport
> + */
> +int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
> +{
> + const struct vsock_transport *new_transport;
> + struct sock *sk = sk_vsock(vsk);
> +
> + switch (sk->sk_type) {
> + case SOCK_DGRAM:
> + new_transport = transport_dgram;
> + break;
> + case SOCK_STREAM:
> + if (vsk->remote_addr.svm_cid > VMADDR_CID_HOST)
> +...
2016 Dec 08
1
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...gt; #include <net/af_vsock.h>
>
> @@ -1105,6 +1106,7 @@ static void vsock_connect_timeout(struct work_struct *work)
> {
> struct sock *sk;
> struct vsock_sock *vsk;
> + int cancel = 0;
>
> vsk = container_of(work, struct vsock_sock, dwork.work);
> sk = sk_vsock(vsk);
> @@ -1115,8 +1117,11 @@ static void vsock_connect_timeout(struct work_struct *work)
> sk->sk_state = SS_UNCONNECTED;
> sk->sk_err = ETIMEDOUT;
> sk->sk_error_report(sk);
> + cancel = 1;
> }
> release_sock(sk);
> + if (cancel)
> + virtio_tran...
2016 Dec 08
1
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...gt; #include <net/af_vsock.h>
>
> @@ -1105,6 +1106,7 @@ static void vsock_connect_timeout(struct work_struct *work)
> {
> struct sock *sk;
> struct vsock_sock *vsk;
> + int cancel = 0;
>
> vsk = container_of(work, struct vsock_sock, dwork.work);
> sk = sk_vsock(vsk);
> @@ -1115,8 +1117,11 @@ static void vsock_connect_timeout(struct work_struct *work)
> sk->sk_state = SS_UNCONNECTED;
> sk->sk_err = ETIMEDOUT;
> sk->sk_error_report(sk);
> + cancel = 1;
> }
> release_sock(sk);
> + if (cancel)
> + virtio_tran...
2023 Feb 16
0
[RFC PATCH v1 07/12] vsock/virtio: MGS_ZEROCOPY flag support
...>+}
>+
>+static int virtio_transport_init_zcopy_skb(struct vsock_sock *vsk,
>+ struct sk_buff *skb,
>+ struct iov_iter *iter,
>+ bool zerocopy)
>+{
>+ struct ubuf_info_msgzc *uarg_zc;
>+ struct ubuf_info *uarg;
>+
>+ uarg = msg_zerocopy_realloc(sk_vsock(vsk),
>+ iov_length(iter->iov, iter->nr_segs),
>+ NULL);
>+
>+ if (!uarg)
>+ return -1;
>+
>+ uarg_zc = uarg_to_msgzc(uarg);
>+ uarg_zc->zerocopy = zerocopy ? 1 : 0;
>+
>+ skb_zcopy_init(skb, uarg);
>+
>+ return 0;
>+}
>+
>+static...
2015 May 27
0
[RFC 1/6] VSOCK: Introduce vsock_find_unbound_socket and vsock_bind_dgram_generic
...ind_bound_socket(struct sockaddr_vm *addr)
return NULL;
}
+static struct sock *__vsock_find_unbound_socket(struct sockaddr_vm *addr)
+{
+ struct vsock_sock *vsk;
+
+ list_for_each_entry(vsk, vsock_unbound_sockets, bound_table)
+ if (addr->svm_port == vsk->local_addr.svm_port)
+ return sk_vsock(vsk);
+
+ return NULL;
+}
+
static struct sock *__vsock_find_connected_socket(struct sockaddr_vm *src,
struct sockaddr_vm *dst)
{
@@ -299,6 +310,21 @@ struct sock *vsock_find_bound_socket(struct sockaddr_vm *addr)
}
EXPORT_SYMBOL_GPL(vsock_find_bound_socket);
+struct sock *vsock_find...
2019 Oct 30
0
[PATCH net-next 11/14] vsock: add multi-transports support
...uest transport
> > + * - remote CID <= VMADDR_CID_HOST will use guest->host transport
> > +*/ int vsock_assign_transport(struct vsock_sock *vsk, struct
> > +vsock_sock *psk) {
> > + const struct vsock_transport *new_transport;
> > + struct sock *sk = sk_vsock(vsk);
> > +
> > + switch (sk->sk_type) {
> > + case SOCK_DGRAM:
> > + new_transport = transport_dgram;
> > + break;
> > + case SOCK_STREAM:
> > + if (vsk->remote_addr.svm_cid > VMADDR_CID_...
2016 Dec 07
0
[PATCH 4/4] vsock: cancel packets when failing to connect
.../virtio_vsock.h>
#include <net/sock.h>
#include <net/af_vsock.h>
@@ -1105,6 +1106,7 @@ static void vsock_connect_timeout(struct work_struct *work)
{
struct sock *sk;
struct vsock_sock *vsk;
+ int cancel = 0;
vsk = container_of(work, struct vsock_sock, dwork.work);
sk = sk_vsock(vsk);
@@ -1115,8 +1117,11 @@ static void vsock_connect_timeout(struct work_struct *work)
sk->sk_state = SS_UNCONNECTED;
sk->sk_err = ETIMEDOUT;
sk->sk_error_report(sk);
+ cancel = 1;
}
release_sock(sk);
+ if (cancel)
+ virtio_transport_get_ops()->cancel_pkt(vsk);
sock...
2023 Mar 26
0
[syzbot] [net?] [virt?] [io-uring?] [kvm?] BUG: soft lockup in vsock_connect
...957cdc01c8e8..d47ad27b409d 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -236,6 +236,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
}
virtio_transport_inc_tx_pkt(vvs, skb);
+ skb_set_owner_w(skb, sk_vsock(vsk));
return t_ops->send_pkt(skb);
}
2023 Aug 01
0
[PATCH net-next v5 4/4] vsock/virtio: MSG_ZEROCOPY flag support
...dr(skb, info, src_cid, src_port,
> + dst_cid, dst_port,
> + payload_len);
> +
> + /* Set owner here, because '__zerocopy_sg_from_iter()' uses
> + * owner of skb without check to update 'sk_wmem_alloc'.
> + */
> + if (vsk)
> + skb_set_owner_w(skb, sk_vsock(vsk));
... which can lead to bad things(TM) if the skb goes trough some later
non trivial processing, due to the above skb_set_owner_w().
Additionally can be the following condition be true:
vsk == NULL && (info->msg && payload_len > 0) && zcopy
???
If so it look...
2023 Aug 01
0
[PATCH net-next v5 4/4] vsock/virtio: MSG_ZEROCOPY flag support
...gt; > + payload_len);
> > > +
> > > + /* Set owner here, because '__zerocopy_sg_from_iter()' uses
> > > + * owner of skb without check to update 'sk_wmem_alloc'.
> > > + */
> > > + if (vsk)
> > > + skb_set_owner_w(skb, sk_vsock(vsk));
> >
> > ... which can lead to bad things(TM) if the skb goes trough some later
> > non trivial processing, due to the above skb_set_owner_w().
> >
> > Additionally can be the following condition be true:
> >
> > vsk == NULL && (info->m...
2016 Dec 07
0
[PATCH v2 4/4] vsock: cancel packets when failing to connect
.../virtio_vsock.h>
#include <net/sock.h>
#include <net/af_vsock.h>
@@ -1105,6 +1106,7 @@ static void vsock_connect_timeout(struct work_struct *work)
{
struct sock *sk;
struct vsock_sock *vsk;
+ int cancel = 0;
vsk = container_of(work, struct vsock_sock, dwork.work);
sk = sk_vsock(vsk);
@@ -1115,8 +1117,11 @@ static void vsock_connect_timeout(struct work_struct *work)
sk->sk_state = SS_UNCONNECTED;
sk->sk_err = ETIMEDOUT;
sk->sk_error_report(sk);
+ cancel = 1;
}
release_sock(sk);
+ if (cancel)
+ virtio_transport_get_ops()->cancel_pkt(vsk);
sock...
2019 Nov 11
2
[PATCH net-next 11/14] vsock: add multi-transports support
...VMADDR_CID_HOST will use host->guest transport
> + * - remote CID <= VMADDR_CID_HOST will use guest->host transport */
> +int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock
> +*psk) {
> + const struct vsock_transport *new_transport;
> + struct sock *sk = sk_vsock(vsk);
> +
> + switch (sk->sk_type) {
> + case SOCK_DGRAM:
> + new_transport = transport_dgram;
> + break;
> + case SOCK_STREAM:
> + if (vsk->remote_addr.svm_cid > VMADDR_CID_HOST)
> + new_transport = transport_h2g;
> + else
> + new_transport = transpor...
2019 Nov 11
2
[PATCH net-next 11/14] vsock: add multi-transports support
...VMADDR_CID_HOST will use host->guest transport
> + * - remote CID <= VMADDR_CID_HOST will use guest->host transport */
> +int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock
> +*psk) {
> + const struct vsock_transport *new_transport;
> + struct sock *sk = sk_vsock(vsk);
> +
> + switch (sk->sk_type) {
> + case SOCK_DGRAM:
> + new_transport = transport_dgram;
> + break;
> + case SOCK_STREAM:
> + if (vsk->remote_addr.svm_cid > VMADDR_CID_HOST)
> + new_transport = transport_h2g;
> + else
> + new_transport = transpor...