[PATCH net-next v4 7/8] selftests/net: Synchronize client/server before counters checks

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> On tests that are expecting failure the timeout value is TEST_RETRANSMIT_SEC == 1 second. Which is big enough for most of devices under tests. But on a particularly slow machine/VM, 1 second might be not enough for another thread to be scheduled and atte

[PATCH net-next v4 6/8] selftests/tcp_ao: Fix printing format for uint64_t

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Mohammad Nassiri It's not safe to use '%zu' specifier for printing uint64_t on 32-bit systems. For uint64_t, we should use the 'PRIu64' macro from the inttypes.h library. This ensures that the uint64_t is printed correctly from the selftests regardless of the system architecture. Signed-of

[PATCH net-next v4 5/8] selftests/net: Don't forget to close nsfd after switch_save_ns()

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> The switch_save_ns() helper suppose to help switching to another namespace for some action and to return back to original namespace. The fd should be closed. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- tools/testing/selftests/net/tcp_ao/l

[PATCH net-next v4 8/8] selftests/net: Add trace events matching to tcp_ao

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Setup trace points, add a new ftrace instance in order to not interfere with the rest of the system, filtering by net namespace cookies. Raise a new background thread that parses trace_pipe, matches them with the list of expected events. Wiring up trace

[PATCH net-next v4 4/8] selftests/net: Open /proc/thread-self in open_netns()

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> It turns to be that open_netns() is called rarely from the child-thread and more often from parent-thread. Yet, on initialization of kconfig checks, either of threads may reach kconfig_lock mutex first. VRF-related checks do create a temporary ksft-check

[PATCH net-next v4 0/8] net/selftests: TCP-AO selftests updates

2024-08-23 Thread Dmitry Safonov via B4 Relay
First 3 patches are more-or-less cleanups/preparations. Patches 4/5 are fixes for netns file descriptors leaks/open. Patch 6 was sent to me/contributed off-list by Mohammad, who wants 32-bit kernels to run TCP-AO. Patch 7 is a workaround/fix for slow VMs. Albeit, I can't reproduce the issue, but

[PATCH net-next v4 3/8] selftests/net: Be consistent in kconfig checks

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Most of the functions in tcp-ao lib/ return negative errno or -1 in case of a failure. That creates inconsistencies in lib/kconfig, which saves what was the error code. As well as the uninitialized kconfig value is -1, which also may be the result of a c

[PATCH net-next v4 1/8] selftests/net: Clean-up double assignment

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Correct copy'n'paste typo: the previous line already initialises get_all to 1. Reported-by: Nassiri, Mohammad Closes: https://lore.kernel.org/all/dm6pr04mb4202bc58a9fd5bdd24a16e8ec5...@dm6pr04mb4202.namprd04.prod.outlook.com/ Signed-off-by: Dmitry Saf

[PATCH net-next v4 2/8] selftests/net: Provide test_snprintf() helper

2024-08-23 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Instead of pre-allocating a fixed-sized buffer of TEST_MSG_BUFFER_SIZE and printing into it, call vsnprintf() with str = NULL, which will return the needed size of the buffer. This hack is documented in man 3 vsnprintf. Essentially, in C++ terms, it re-

[PATCH net-next v3 7/8] selftests/net: Synchronize client/server before counters checks

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> On tests that are expecting failure the timeout value is TEST_RETRANSMIT_SEC == 1 second. Which is big enough for most of devices under tests. But on a particularly slow machine/VM, 1 second might be not enough for another thread to be scheduled and atte

[PATCH net-next v3 5/8] selftests/net: Don't forget to close nsfd after switch_save_ns()

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> The switch_save_ns() helper suppose to help switching to another namespace for some action and to return back to original namespace. The fd should be closed. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- tools/testing/selftests/net/tcp_ao/l

[PATCH net-next v3 8/8] selftests/net: Add trace events matching to tcp_ao

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Setup trace points, add a new ftrace instance in order to not interfere with the rest of the system, filtering by net namespace cookies. Raise a new background thread that parses trace_pipe, matches them with the list of expected events. Wiring up trace

[PATCH net-next v3 4/8] selftests/net: Open /proc/thread-self in open_netns()

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> It turns to be that open_netns() is called rarely from the child-thread and more often from parent-thread. Yet, on initialization of kconfig checks, either of threads may reach kconfig_lock mutex first. VRF-related checks do create a temprary ksft-check

[PATCH net-next v3 3/8] selftests/net: Be consistent in kconfig checks

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Most of the functions in tcp-ao lib/ return negative errno or -1 in case of a failure. That creates inconsistencies in lib/kconfig, which saves what was the error code. As well as the uninitialized kconfig value is -1, which also may be the result of a c

[PATCH net-next v3 6/8] selftests/tcp_ao: Fix printing format for uint64_t

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Mohammad Nassiri It's not safe to use '%zu' specifier for printing uint64_t on 32-bit systems. For uint64_t, we should use the 'PRIu64' macro from the inttypes.h library. This ensures that the uint64_t is printed correctly from the selftests regardless of the system architecture. Signed-of

[PATCH net-next v3 1/8] selftests/net: Clean-up double assignment

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Correct copy'n'paste typo: the previous line already initialises get_all to 1. Reported-by: Nassiri, Mohammad Closes: https://lore.kernel.org/all/dm6pr04mb4202bc58a9fd5bdd24a16e8ec5...@dm6pr04mb4202.namprd04.prod.outlook.com/ Signed-off-by: Dmitry Saf

[PATCH net-next v3 2/8] selftests/net: Provide test_snprintf() helper

2024-08-15 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Instead of pre-allocating a fixed-sized buffer of TEST_MSG_BUFFER_SIZE and printing into it, call vsnprintf() with str = NULL, which will return the needed size of the buffer. This hack is documented in man 3 vsnprintf. Essentially, in C++ terms, it re-

[PATCH net-next v3 0/8] net/selftests: TCP-AO selftests updates

2024-08-15 Thread Dmitry Safonov via B4 Relay
First 3 patches are more-or-less cleanups/preparations. Patches 4/5 are fixes for netns file descriptors leaks/open. Patch 6 was sent to me/contributed off-list by Mohammad, who wants 32-bit kernels to run TCP-AO. Patch 7 is a workaround/fix for slow VMs. Albeit, I can't reproduce the issue, but

[PATCH net-next v2 7/7] selftests/net: Add trace events matching to tcp_ao

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Setup trace points, add a new ftrace instance in order to not interfere with the rest of the system, filtering by net namespace cookies. Raise a new background thread that parses trace_pipe, matches them with the list of expected events. Wiring up trace

[PATCH net-next v2 6/7] selftests/net: Synchronize client/server before counters checks

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> On tests that are expecting failure the timeout value is TEST_RETRANSMIT_SEC == 1 second. Which is big enough for most of devices under tests. But on a particularly slow machine/VM, 1 second might be not enough for another thread to be scheduled and atte

[PATCH net-next v2 2/7] selftests/net: Provide test_snprintf() helper

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Instead of pre-allocating a fixed-sized buffer of TEST_MSG_BUFFER_SIZE and printing into it, call vsnprintf() with str = NULL, which will return the needed size of the buffer. This hack is documented in man 3 vsnprintf. Essentially, in C++ terms, it re-

[PATCH net-next v2 4/7] selftests/net: Don't forget to close nsfd after switch_save_ns()

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> The switch_save_ns() helper suppose to help switching to another namespace for some action and to return back to original namespace. The fd should be closed. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- tools/testing/selftests/net/tcp_ao/l

[PATCH net-next v2 5/7] selftests/tcp_ao: Fix printing format for uint64_t

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Mohammad Nassiri It's not safe to use '%zu' specifier for printing uint64_t on 32-bit systems. For uint64_t, we should use the 'PRIu64' macro from the inttypes.h library. This ensures that the uint64_t is printed correctly from the selftests regardless of the system architecture. Signed-of

[PATCH net-next v2 1/7] selftests/net: Clean-up double assignment

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Correct copy'n'paste typo: the previous line already initialises get_all to 1. Reported-by: Nassiri, Mohammad Closes: https://lore.kernel.org/all/dm6pr04mb4202bc58a9fd5bdd24a16e8ec5...@dm6pr04mb4202.namprd04.prod.outlook.com/ Signed-off-by: Dmitry Saf

[PATCH net-next v2 3/7] selftests/net: Be consistent in kconfig checks

2024-08-02 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Most of the functions in tcp-ao lib/ return negative errno or -1 in case of a failure. That creates inconsistencies in lib/kconfig, which saves what was the error code. As well as the uninitialized kconfig value is -1, which also may be the result of a c

[PATCH net-next v2 0/7] net/selftests: TCP-AO selftests updates

2024-08-02 Thread Dmitry Safonov via B4 Relay
First 4 patches are more-or-less cleanups/preparations. Patch 5 was sent to me/contributed off-list by Mohammad, who wants 32-bit kernels to run TCP-AO. Patch 6 is a workaround/fix for slow VMs. Albeit, I can't reproduce the issue, but I hope it will fix netdev flakes for connect-deny-* tests. A

[PATCH net-next 7/7] selftests/net: Add trace events matching to tcp_ao

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Setup trace points, add a new ftrace instance in order to not interfere with the rest of the system, filtering by net namespace cookies. Raise a new background thread that parses trace_pipe, matches them with the list of expected events. Wiring up trace

[PATCH net-next 5/7] selftests/tcp_ao: Fix printing format for uint64_t

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Mohammad Nassiri It's not safe to use '%zu' specifier for printing uint64_t on 32-bit systems. For uint64_t, we should use the 'PRIu64' macro from the inttypes.h library. This ensures that the uint64_t is printed correctly from the selftests regardless of the system architecture. Signed-of

[PATCH net-next 3/7] selftests/net: Be consistent in kconfig checks

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Most of the functions in tcp-ao lib/ return negative errno or -1 in case of a failure. That creates inconsistencies in lib/kconfig, which saves what was the error code. As well as the uninitialized kconfig value is -1, which also may be the result of a c

[PATCH net-next 6/7] selftests/net: Synchronize client/server before counters checks

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> On tests that are expecting failure the timeout value is TEST_RETRANSMIT_SEC == 1 second. Which is big enough for most of devices under tests. But on a particularly slow machine/VM, 1 second might be not enough for another thread to be scheduled and atte

[PATCH net-next 4/7] selftests/net: Don't forget to close nsfd after switch_save_ns()

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> The switch_save_ns() helper suppose to help switching to another namespace for some action and to return back to original namespace. The fd should be closed. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- tools/testing/selftests/net/tcp_ao/l

[PATCH net-next 0/7] net/selftests: TCP-AO selftests updates

2024-07-29 Thread Dmitry Safonov via B4 Relay
First 4 patches are more-or-less cleanups/preparations. Patch 5 was sent to me/contributed off-list by Mohammad, who wants 32-bit kernels to run TCP-AO. Patch 6 is a workaround/fix for slow VMs. Albeit, I can't reproduce the issue, but I hope it will fix netdev flakes for connect-deny-* tests. A

[PATCH net-next 2/7] selftests/net: Provide test_snprintf() helper

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Re-invented std::stringstream :-) No need for buffer array - malloc() it. It's going to be helpful of path concat printings. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- tools/testing/selftests/net/tcp_ao/lib/aolib.h | 56 +

[PATCH net-next 1/7] selftests/net: Clean-up double assignment

2024-07-29 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Yeah, copy'n'paste typo. Reported-by: Nassiri, Mohammad Closes: https://lore.kernel.org/all/dm6pr04mb4202bc58a9fd5bdd24a16e8ec5...@dm6pr04mb4202.namprd04.prod.outlook.com/ Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- tools/testing/selftes

[PATCH net 3/4] selftests/tcp_ao: Fix fscanf() call for format-security

2024-04-12 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> On my new laptop with packages from nixos-unstable, gcc 12.3.0 produces: > lib/proc.c: In function ‘netstat_read_type’: > lib/proc.c:89:9: error: format not a string literal and no format arguments > [-Werror=format-security] >89 | if (fscan

[PATCH net 2/4] selftests/tcp_ao: Zero-init tcp_ao_info_opt

2024-04-12 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> The structure is on the stack and has to be zero-initialized as the kernel checks for: > if (in.reserved != 0 || in.reserved2 != 0) > return -EINVAL; Fixes: b26660531cf6 ("selftests/net: Add test for TCP-AO add setsockopt() command"

[PATCH net 0/4] selftests/net/tcp_ao: A bunch of fixes for TCP-AO selftests

2024-04-12 Thread Dmitry Safonov via B4 Relay
Started as addressing the flakiness issues in rst_ipv*, that affect netdev dashboard. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- Dmitry Safonov (4): selftests/tcp_ao: Make RST tests less flaky selftests/tcp_ao: Zero-init tcp_ao_info_opt selftests/tcp_ao: Fix fscanf(

[PATCH net 4/4] selftests/tcp_ao: Printing fixes to confirm with format-security

2024-04-12 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> On my new laptop with packages from nixos-unstable, gcc 12.3.0 produces > lib/setup.c: In function ‘__test_msg’: > lib/setup.c:20:9: error: format not a string literal and no format arguments > [-Werror=format-security] >20 | ksft_print_msg(

[PATCH net 1/4] selftests/tcp_ao: Make RST tests less flaky

2024-04-12 Thread Dmitry Safonov via B4 Relay
From: Dmitry Safonov <0x7f454...@gmail.com> Currently, "active reset" cases are flaky, because select() is called for 3 sockets, while only 2 are expected to receive RST. The idea of the third socket was to get into request_sock_queue, but the test mistakenly attempted to connect() after the liste