Re: [PATCH v2 net 3/3] selftest: net: Check wraparounds for sk->sk_rmem_alloc.
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2025-03-26 14:10:01
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2025-03-26 14:10:01
Kuniyuki Iwashima wrote:
The test creates client and server sockets and sets INT_MAX to the server's SO_RCVBUFFORCE. Then, the client floods packets to the server until the UDP memory usage reaches (INT_MAX + 1) >> PAGE_SHIFT. Finally, both sockets are close()d, and the last assert makes sure that the memory usage drops to 0. If needed, we can extend the test later for other protocols. Without patch 1: # Starting 2 tests from 2 test cases. # RUN so_rcvbuf.udp_ipv4.rmem_max ... # so_rcvbuf.c:163:rmem_max:Expected pages (524800) <= *variant->max_pages (524288) # rmem_max: Test terminated by assertion # FAIL so_rcvbuf.udp_ipv4.rmem_max not ok 1 so_rcvbuf.udp_ipv4.rmem_max Without patch 2: # RUN so_rcvbuf.udp_ipv4.rmem_max ... # so_rcvbuf.c:170:rmem_max:max_pages: 524288 # so_rcvbuf.c:178:rmem_max:Expected get_prot_pages(_metadata, variant) (524288) == 0 (0) # rmem_max: Test terminated by assertion # FAIL so_rcvbuf.udp_ipv4.rmem_max not ok 1 so_rcvbuf.udp_ipv4.rmem_max Signed-off-by: Kuniyuki Iwashima <redacted>
Reviewed-by: Willem de Bruijn <willemb@google.com>