<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/vmw_vsock, branch linux-5.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-08-18T07:07:02Z</updated>
<entry>
<title>vsock/virtio: avoid potential deadlock when vsock device remove</title>
<updated>2021-08-18T07:07:02Z</updated>
<author>
<name>Longpeng(Mike)</name>
</author>
<published>2021-08-12T05:30:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=09625c5badd23a2eeaee252dc81f7dbc7082e7ed'/>
<id>urn:sha1:09625c5badd23a2eeaee252dc81f7dbc7082e7ed</id>
<content type='text'>
[ Upstream commit 49b0b6ffe20c5344f4173f3436298782a08da4f2 ]

There's a potential deadlock case when remove the vsock device or
process the RESET event:

  vsock_for_each_connected_socket:
      spin_lock_bh(&amp;vsock_table_lock) ----------- (1)
      ...
          virtio_vsock_reset_sock:
              lock_sock(sk) --------------------- (2)
      ...
      spin_unlock_bh(&amp;vsock_table_lock)

lock_sock() may do initiative schedule when the 'sk' is owned by
other thread at the same time, we would receivce a warning message
that "scheduling while atomic".

Even worse, if the next task (selected by the scheduler) try to
release a 'sk', it need to request vsock_table_lock and the deadlock
occur, cause the system into softlockup state.
  Call trace:
   queued_spin_lock_slowpath
   vsock_remove_bound
   vsock_remove_sock
   virtio_transport_release
   __vsock_release
   vsock_release
   __sock_release
   sock_close
   __fput
   ____fput

So we should not require sk_lock in this case, just like the behavior
in vhost_vsock or vmci.

Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko")
Cc: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Longpeng(Mike) &lt;longpeng2@huawei.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Link: https://lore.kernel.org/r/20210812053056.1699-1-longpeng2@huawei.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock: notify server to shutdown when client has pending signal</title>
<updated>2021-07-19T08:04:42Z</updated>
<author>
<name>Longpeng(Mike)</name>
</author>
<published>2021-06-21T06:26:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f033a30e32cefb956cf0a18afca17c8a267aa147'/>
<id>urn:sha1:f033a30e32cefb956cf0a18afca17c8a267aa147</id>
<content type='text'>
[ Upstream commit c7ff9cff70601ea19245d997bb977344663434c7 ]

The client's sk_state will be set to TCP_ESTABLISHED if the server
replay the client's connect request.

However, if the client has pending signal, its sk_state will be set
to TCP_CLOSE without notify the server, so the server will hold the
corrupt connection.

            client                        server

1. sk_state=TCP_SYN_SENT         |
2. call -&gt;connect()              |
3. wait reply                    |
                                 | 4. sk_state=TCP_ESTABLISHED
                                 | 5. insert to connected list
                                 | 6. reply to the client
7. sk_state=TCP_ESTABLISHED      |
8. insert to connected list      |
9. *signal pending* &lt;--------------------- the user kill client
10. sk_state=TCP_CLOSE           |
client is exiting...             |
11. call -&gt;release()             |
     virtio_transport_close
      if (!(sk-&gt;sk_state == TCP_ESTABLISHED ||
	      sk-&gt;sk_state == TCP_CLOSING))
		return true; *return at here, the server cannot notice the connection is corrupt*

So the client should notify the peer in this case.

Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Jorgen Hansen &lt;jhansen@vmware.com&gt;
Cc: Norbert Slusarek &lt;nslusarek@gmx.net&gt;
Cc: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Cc: Colin Ian King &lt;colin.king@canonical.com&gt;
Cc: David Brazdil &lt;dbrazdil@google.com&gt;
Cc: Alexander Popov &lt;alex.popov@linux.com&gt;
Suggested-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Link: https://lkml.org/lkml/2021/5/17/418
Signed-off-by: lixianming &lt;lixianming5@huawei.com&gt;
Signed-off-by: Longpeng(Mike) &lt;longpeng2@huawei.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/vmci: Remove redundant assignment to err</title>
<updated>2021-04-30T22:00:59Z</updated>
<author>
<name>Yang Li</name>
</author>
<published>2021-04-30T09:27:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0a5818b472c574a985cfeb6518a5ba395f26b3c'/>
<id>urn:sha1:f0a5818b472c574a985cfeb6518a5ba395f26b3c</id>
<content type='text'>
Variable 'err' is set to zero but this value is never read as it is
overwritten with a new value later on, hence it is a redundant
assignment and can be removed.

Clean up the following clang-analyzer warning:

net/vmw_vsock/vmci_transport.c:948:2: warning: Value stored to 'err' is
never read [clang-analyzer-deadcode.DeadStores]

Reported-by: Abaci Robot &lt;abaci@linux.alibaba.com&gt;
Signed-off-by: Yang Li &lt;yang.lee@linux.alibaba.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net</title>
<updated>2021-04-26T19:00:00Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2021-04-26T19:00:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6876a18d3361e1893187970e1881a1d88d894d3f'/>
<id>urn:sha1:6876a18d3361e1893187970e1881a1d88d894d3f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>vsock/virtio: free queued packets when closing socket</title>
<updated>2021-04-21T00:07:21Z</updated>
<author>
<name>Stefano Garzarella</name>
</author>
<published>2021-04-20T11:07:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8432b8114957235f42e070a16118a7f750de9d39'/>
<id>urn:sha1:8432b8114957235f42e070a16118a7f750de9d39</id>
<content type='text'>
As reported by syzbot [1], there is a memory leak while closing the
socket. We partially solved this issue with commit ac03046ece2b
("vsock/virtio: free packets during the socket release"), but we
forgot to drain the RX queue when the socket is definitely closed by
the scheduled work.

To avoid future issues, let's use the new virtio_transport_remove_sock()
to drain the RX queue before removing the socket from the af_vsock lists
calling vsock_remove_sock().

[1] https://syzkaller.appspot.com/bug?extid=24452624fc4c571eedd9

Fixes: ac03046ece2b ("vsock/virtio: free packets during the socket release")
Reported-and-tested-by: syzbot+24452624fc4c571eedd9@syzkaller.appspotmail.com
Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>vsock/vmci: log once the failed queue pair allocation</title>
<updated>2021-04-19T21:30:23Z</updated>
<author>
<name>Stefano Garzarella</name>
</author>
<published>2021-04-16T10:44:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e16edc99d658cd41c60a44cc14d170697aa3271f'/>
<id>urn:sha1:e16edc99d658cd41c60a44cc14d170697aa3271f</id>
<content type='text'>
VMCI feature is not supported in conjunction with the vSphere Fault
Tolerance (FT) feature.

VMware Tools can repeatedly try to create a vsock connection. If FT is
enabled the kernel logs is flooded with the following messages:

    qp_alloc_hypercall result = -20
    Could not attach to queue pair with -20

"qp_alloc_hypercall result = -20" was hidden by commit e8266c4c3307
("VMCI: Stop log spew when qp allocation isn't possible"), but "Could
not attach to queue pair with -20" is still there flooding the log.

Since the error message can be useful in some cases, print it only once.

Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Reviewed-by: Jorgen Hansen &lt;jhansen@vmware.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: vsock: Fix a typo</title>
<updated>2021-03-29T00:52:51Z</updated>
<author>
<name>Lu Wei</name>
</author>
<published>2021-03-27T02:27:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9195f06b2d0fd0d1cc1552970d890c21f6b9492f'/>
<id>urn:sha1:9195f06b2d0fd0d1cc1552970d890c21f6b9492f</id>
<content type='text'>
Modify "occured" to "occurred" in net/vmw_vsock/af_vsock.c.

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Lu Wei &lt;luwei32@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selinux: vsock: Set SID for socket returned by accept()</title>
<updated>2021-03-19T20:46:55Z</updated>
<author>
<name>David Brazdil</name>
</author>
<published>2021-03-19T13:05:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1f935e8e72ec28dddb2dc0650b3b6626a293d94b'/>
<id>urn:sha1:1f935e8e72ec28dddb2dc0650b3b6626a293d94b</id>
<content type='text'>
For AF_VSOCK, accept() currently returns sockets that are unlabelled.
Other socket families derive the child's SID from the SID of the parent
and the SID of the incoming packet. This is typically done as the
connected socket is placed in the queue that accept() removes from.

Reuse the existing 'security_sk_clone' hook to copy the SID from the
parent (server) socket to the child. There is no packet SID in this
case.

Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: David Brazdil &lt;dbrazdil@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>vsock: fix locking in vsock_shutdown()</title>
<updated>2021-02-09T23:31:22Z</updated>
<author>
<name>Stefano Garzarella</name>
</author>
<published>2021-02-09T08:52:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1c5fae9c9a092574398a17facc31c533791ef232'/>
<id>urn:sha1:1c5fae9c9a092574398a17facc31c533791ef232</id>
<content type='text'>
In vsock_shutdown() we touched some socket fields without holding the
socket lock, such as 'state' and 'sk_flags'.

Also, after the introduction of multi-transport, we are accessing
'vsk-&gt;transport' in vsock_send_shutdown() without holding the lock
and this call can be made while the connection is in progress, so
the transport can change in the meantime.

To avoid issues, we hold the socket lock when we enter in
vsock_shutdown() and release it when we leave.

Among the transports that implement the 'shutdown' callback, only
hyperv_transport acquired the lock. Since the caller now holds it,
we no longer take it.

Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>vsock/virtio: update credit only if socket is not closed</title>
<updated>2021-02-08T21:27:46Z</updated>
<author>
<name>Stefano Garzarella</name>
</author>
<published>2021-02-08T14:44:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ce7536bc7398e2ae552d2fabb7e0e371a9f1fe46'/>
<id>urn:sha1:ce7536bc7398e2ae552d2fabb7e0e371a9f1fe46</id>
<content type='text'>
If the socket is closed or is being released, some resources used by
virtio_transport_space_update() such as 'vsk-&gt;trans' may be released.

To avoid a use after free bug we should only update the available credit
when we are sure the socket is still open and we have the lock held.

Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Acked-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Link: https://lore.kernel.org/r/20210208144454.84438-1-sgarzare@redhat.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
