mbox series

[net-next,v3,0/7] vsock/test: Tests for memory leaks

Message ID 20241218-test-vsock-leaks-v3-0-f1a4dcef9228@rbox.co (mailing list archive)
Headers show
Series vsock/test: Tests for memory leaks | expand

Message

Michal Luczaj Dec. 18, 2024, 2:32 p.m. UTC
Series adds tests for recently fixed memory leaks[1]:

commit d7b0ff5a8667 ("virtio/vsock: Fix accept_queue memory leak")
commit fbf7085b3ad1 ("vsock: Fix sk_error_queue memory leak")
commit 60cf6206a1f5 ("virtio/vsock: Improve MSG_ZEROCOPY error handling")

Patch 1/6 is a non-functional preparatory cleanup.
Patch 2/6 is a test suite extension for picking specific tests.
Patch 3/6 explains the need of kmemleak scans.
Patches 4-5-6 add the tests.

NOTE: Test in patch 6/6 ("vsock/test: Add test for MSG_ZEROCOPY completion
memory leak") may stop working even before this series is merged. See
changes proposed in [2]. The failslab variant would be unaffected.

[1] https://lore.kernel.org/netdev/20241107-vsock-mem-leaks-v2-0-4e21bfcfc818@rbox.co/
[2] https://lore.kernel.org/netdev/CANn89i+oL+qoPmbbGvE_RT3_3OWgeck7cCPcTafeehKrQZ8kyw@mail.gmail.com/

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
Changes in v3:
- Allow for multiple tests selection (Stefano)
- Generalize CONTINUE/DONE control messages (Stefano)
- Collect R-b (Stefano)
- Link to v2: https://lore.kernel.org/r/20241216-test-vsock-leaks-v2-0-55e1405742fc@rbox.co

Changes in v2:
- Introduce a vsock_test option to run a single test
- ZC completion test: rewrite, comment, describe failslab approach (Stefano)
- accept_queue test: rewrite, comment (Stefano)
- Annotate functions and commits about the need of kmemleak (Stefano)
- Add README section about kmemleak (Stefano)
- Collect R-b (Luigi, Stefano)
- Link to v1: https://lore.kernel.org/r/20241206-test-vsock-leaks-v1-0-c31e8c875797@rbox.co

---
Michal Luczaj (7):
      vsock/test: Use NSEC_PER_SEC
      vsock/test: Introduce option to select tests
      vsock/test: Add README blurb about kmemleak usage
      vsock/test: Adapt send_byte()/recv_byte() to handle MSG_ZEROCOPY
      vsock/test: Add test for accept_queue memory leak
      vsock/test: Add test for sk_error_queue memory leak
      vsock/test: Add test for MSG_ZEROCOPY completion memory leak

 tools/testing/vsock/README       |  15 +++
 tools/testing/vsock/util.c       |  33 ++++-
 tools/testing/vsock/util.h       |   2 +
 tools/testing/vsock/vsock_test.c | 265 ++++++++++++++++++++++++++++++++++++++-
 4 files changed, 309 insertions(+), 6 deletions(-)
---
base-commit: 2c2b61d2138f472e50b5531ec0cb4a1485837e21
change-id: 20241203-test-vsock-leaks-38f9559f5636

Best regards,

Comments

Michal Luczaj Dec. 18, 2024, 2:38 p.m. UTC | #1
On 12/18/24 15:32, Michal Luczaj wrote:
> Series adds tests for recently fixed memory leaks[1]:
> 
> commit d7b0ff5a8667 ("virtio/vsock: Fix accept_queue memory leak")
> commit fbf7085b3ad1 ("vsock: Fix sk_error_queue memory leak")
> commit 60cf6206a1f5 ("virtio/vsock: Improve MSG_ZEROCOPY error handling")
> 
> Patch 1/6 is a non-functional preparatory cleanup.
> Patch 2/6 is a test suite extension for picking specific tests.
> Patch 3/6 explains the need of kmemleak scans.
> Patches 4-5-6 add the tests.
> 
> NOTE: Test in patch 6/6 ("vsock/test: Add test for MSG_ZEROCOPY completion
> memory leak") may stop working even before this series is merged. See
> changes proposed in [2]. The failslab variant would be unaffected. [...]

Bah, I've added one more patch: "vsock/test: Adapt send_byte()/recv_byte()
to handle MSG_ZEROCOPY" and broke the numbering above, sorry.

Michal
Stefano Garzarella Dec. 18, 2024, 5:58 p.m. UTC | #2
On Wed, Dec 18, 2024 at 03:38:17PM +0100, Michal Luczaj wrote:
>On 12/18/24 15:32, Michal Luczaj wrote:
>> Series adds tests for recently fixed memory leaks[1]:
>>
>> commit d7b0ff5a8667 ("virtio/vsock: Fix accept_queue memory leak")
>> commit fbf7085b3ad1 ("vsock: Fix sk_error_queue memory leak")
>> commit 60cf6206a1f5 ("virtio/vsock: Improve MSG_ZEROCOPY error handling")
>>
>> Patch 1/6 is a non-functional preparatory cleanup.
>> Patch 2/6 is a test suite extension for picking specific tests.
>> Patch 3/6 explains the need of kmemleak scans.
>> Patches 4-5-6 add the tests.
>>
>> NOTE: Test in patch 6/6 ("vsock/test: Add test for MSG_ZEROCOPY completion
>> memory leak") may stop working even before this series is merged. See
>> changes proposed in [2]. The failslab variant would be unaffected. [...]
>
>Bah, I've added one more patch: "vsock/test: Adapt send_byte()/recv_byte()
>to handle MSG_ZEROCOPY" and broke the numbering above, sorry.

Not a problem at all ;-)

Thanks for this series again, LGTM!
I reviewed all of the patches and tested them.

Stefano