<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/testing/vsock, branch v6.15</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.15</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.15'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-05-13T22:01:50Z</updated>
<entry>
<title>vsock/test: Fix occasional failure in SIOCOUTQ tests</title>
<updated>2025-05-13T22:01:50Z</updated>
<author>
<name>Konstantin Shkolnyy</name>
<email>kshk@linux.ibm.com</email>
</author>
<published>2025-05-07T15:14:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7fd7ad6f36af36f30a06d165eff3780cb139fa79'/>
<id>urn:sha1:7fd7ad6f36af36f30a06d165eff3780cb139fa79</id>
<content type='text'>
These tests:
    "SOCK_STREAM ioctl(SIOCOUTQ) 0 unsent bytes"
    "SOCK_SEQPACKET ioctl(SIOCOUTQ) 0 unsent bytes"
output: "Unexpected 'SIOCOUTQ' value, expected 0, got 64 (CLIENT)".

They test that the SIOCOUTQ ioctl reports 0 unsent bytes after the data
have been received by the other side. However, sometimes there is a delay
in updating this "unsent bytes" counter, and the test fails even though
the counter properly goes to 0 several milliseconds later.

The delay occurs in the kernel because the used buffer notification
callback virtio_vsock_tx_done(), called upon receipt of the data by the
other side, doesn't update the counter itself. It delegates that to
a kernel thread (via vsock-&gt;tx_work). Sometimes that thread is delayed
more than the test expects.

Change the test to poll SIOCOUTQ until it returns 0 or a timeout occurs.

Signed-off-by: Konstantin Shkolnyy &lt;kshk@linux.ibm.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Fixes: 18ee44ce97c1 ("test/vsock: add ioctl unsent bytes test")
Link: https://patch.msgid.link/20250507151456.2577061-1-kshk@linux.ibm.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Add test for SO_LINGER null ptr deref</title>
<updated>2025-02-13T04:01:29Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2025-02-10T12:15:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=440c9d488705366b00372ea7213af69827a6c7af'/>
<id>urn:sha1:440c9d488705366b00372ea7213af69827a6c7af</id>
<content type='text'>
Explicitly close() a TCP_ESTABLISHED (connectible) socket with SO_LINGER
enabled.

As for now, test does not verify if close() actually lingers.
On an unpatched machine, may trigger a null pointer dereference.

Tested-by: Luigi Leonardi &lt;leonardi@redhat.com&gt;
Reviewed-by: Luigi Leonardi &lt;leonardi@redhat.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20250210-vsock-linger-nullderef-v3-2-ef6244d02b54@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Add test for connect() retries</title>
<updated>2025-01-30T02:50:37Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2025-01-28T13:15:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4695f64e028dd1407d077565fbdb30ddb364180a'/>
<id>urn:sha1:4695f64e028dd1407d077565fbdb30ddb364180a</id>
<content type='text'>
Deliberately fail a connect() attempt; expect error. Then verify that
subsequent attempt (using the same socket) can still succeed, rather than
fail outright.

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Reviewed-by: Luigi Leonardi &lt;leonardi@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-6-1cf57065b770@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Add test for UAF due to socket unbinding</title>
<updated>2025-01-30T02:50:37Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2025-01-28T13:15:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=301a62dfb0d0dff79460ed3a54e1f8dbd8db52e9'/>
<id>urn:sha1:301a62dfb0d0dff79460ed3a54e1f8dbd8db52e9</id>
<content type='text'>
Fail the autobind, then trigger a transport reassign. Socket might get
unbound from unbound_sockets, which then leads to a reference count
underflow.

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-5-1cf57065b770@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Introduce vsock_connect_fd()</title>
<updated>2025-01-30T02:50:37Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2025-01-28T13:15:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ac12b7e2912d60fceefaacc78ee8b5aec8b51c04'/>
<id>urn:sha1:ac12b7e2912d60fceefaacc78ee8b5aec8b51c04</id>
<content type='text'>
Distill timeout-guarded vsock_connect_fd(). Adapt callers.

Suggested-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-4-1cf57065b770@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Introduce vsock_bind()</title>
<updated>2025-01-30T02:50:37Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2025-01-28T13:15:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=852a00c4281d3c4cf82020421cc9b5b05d53e93f'/>
<id>urn:sha1:852a00c4281d3c4cf82020421cc9b5b05d53e93f</id>
<content type='text'>
Add a helper for socket()+bind(). Adapt callers.

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Reviewed-by: Luigi Leonardi &lt;leonardi@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-3-1cf57065b770@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Add test for MSG_ZEROCOPY completion memory leak</title>
<updated>2024-12-23T18:28:01Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2024-12-19T09:49:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d127ac8b1d4d3524d292b597100fef96dd909c9b'/>
<id>urn:sha1:d127ac8b1d4d3524d292b597100fef96dd909c9b</id>
<content type='text'>
Exercise the ENOMEM error path by attempting to hit net.core.optmem_max
limit on send().

Test aims to create a memory leak, kmemleak should be employed.

Fixed by commit 60cf6206a1f5 ("virtio/vsock: Improve MSG_ZEROCOPY error
handling").

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20241219-test-vsock-leaks-v4-7-a416e554d9d7@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Add test for sk_error_queue memory leak</title>
<updated>2024-12-23T18:28:01Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2024-12-19T09:49:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ec50efee8cf814035d82f3b42dad916144d98b38'/>
<id>urn:sha1:ec50efee8cf814035d82f3b42dad916144d98b38</id>
<content type='text'>
Ask for MSG_ZEROCOPY completion notification, but do not recv() it.
Test attempts to create a memory leak, kmemleak should be employed.

Fixed by commit fbf7085b3ad1 ("vsock: Fix sk_error_queue memory leak").

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20241219-test-vsock-leaks-v4-6-a416e554d9d7@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Add test for accept_queue memory leak</title>
<updated>2024-12-23T18:28:01Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2024-12-19T09:49:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f66ef469a72d19764f943067307a570f83b00dca'/>
<id>urn:sha1:f66ef469a72d19764f943067307a570f83b00dca</id>
<content type='text'>
Attempt to enqueue a child after the queue was flushed, but before
SOCK_DONE flag has been set.

Test tries to produce a memory leak, kmemleak should be employed. Dealing
with a race condition, test by its very nature may lead to a false
negative.

Fixed by commit d7b0ff5a8667 ("virtio/vsock: Fix accept_queue memory
leak").

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20241219-test-vsock-leaks-v4-5-a416e554d9d7@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>vsock/test: Adapt send_byte()/recv_byte() to handle MSG_ZEROCOPY</title>
<updated>2024-12-23T18:28:01Z</updated>
<author>
<name>Michal Luczaj</name>
<email>mhal@rbox.co</email>
</author>
<published>2024-12-19T09:49:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f52e7f593b49344b9497c289cbb2ada213f60a7a'/>
<id>urn:sha1:f52e7f593b49344b9497c289cbb2ada213f60a7a</id>
<content type='text'>
For a zerocopy send(), buffer (always byte 'A') needs to be preserved (thus
it can not be on the stack) or the data recv()ed check in recv_byte() might
fail.

While there, change the printf format to 0x%02x so the '\0' bytes can be
seen.

Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Michal Luczaj &lt;mhal@rbox.co&gt;
Link: https://patch.msgid.link/20241219-test-vsock-leaks-v4-4-a416e554d9d7@rbox.co
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
