* [PATCH net-next v2 1/3] selftests: net: report SO_RCV test failures to the runner
2026-11-25 6:41 [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
@ 2026-11-25 6:41 ` Jingjing Xu
2026-11-25 7:18 ` Hangbin Liu
2026-11-25 6:41 ` [PATCH net-next v2 2/3] selftests: net: enable receive metadata independently of its value Jingjing Xu
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Jingjing Xu @ 2026-11-25 6:41 UTC (permalink / raw)
To: netdev
Cc: linux-kselftest, kuba, edumazet, pabeni, horms, shuah, willemb,
annaemesenyiri, idosch, hangbin.liu
test_so_rcv.sh uses KSFT_FAIL and KSFT_PASS, but lib.sh defines the
lowercase ksft_fail and ksft_pass constants. With the uppercase variables
unset, exit has no argument and returns the successful echo status, even
when the script has reported failed tests.
Use the constants actually provided by lib.sh so failures produce a
nonzero exit status.
Run as root from tools/testing/selftests/net after building the helpers.
For the original four-case script, this changes only sender metadata to 1
while the listeners still expect 2 or 3:
sed '/\.\/cmsg_sender/s/\$arg/${arg% *} 1/' test_so_rcv.sh | bash
echo $?
Both versions report four failures. The original prints 0 as the exit
status; with this fix it prints 1.
AI-assisted inspection found this while extending the receive tests.
With deliberately mismatched sender metadata, all four original cases
fail on both versions: the original script exits 0 and
the corrected script exits 1. The unmodified sender passes all four cases
with exit 0. No kernel instrumentation or fault injection was used.
Fixes: c935af429ec2 ("selftests: net: add support for testing SO_RCVMARK and SO_RCVPRIORITY")
Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
---
tools/testing/selftests/net/test_so_rcv.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/test_so_rcv.sh b/tools/testing/selftests/net/test_so_rcv.sh
index d8aa4362879d..ae01fa3c5329 100755
--- a/tools/testing/selftests/net/test_so_rcv.sh
+++ b/tools/testing/selftests/net/test_so_rcv.sh
@@ -66,8 +66,8 @@ done
if [ "$FAILED_TESTS" -ne 0 ]; then
echo "FAIL - $FAILED_TESTS/$TOTAL_TESTS tests failed"
- exit ${KSFT_FAIL}
+ exit ${ksft_fail}
else
echo "OK - All $TOTAL_TESTS tests passed"
- exit ${KSFT_PASS}
+ exit ${ksft_pass}
fi
base-commit: 57f165ff2f30491bc3511d24a52ca516751a268b
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v2 1/3] selftests: net: report SO_RCV test failures to the runner
2026-11-25 6:41 ` [PATCH net-next v2 1/3] selftests: net: report SO_RCV test failures to the runner Jingjing Xu
@ 2026-11-25 7:18 ` Hangbin Liu
0 siblings, 0 replies; 8+ messages in thread
From: Hangbin Liu @ 2026-11-25 7:18 UTC (permalink / raw)
To: Jingjing Xu
Cc: netdev, linux-kselftest, kuba, edumazet, pabeni, horms, shuah,
willemb, annaemesenyiri, idosch
On Wed, Nov 25, 2026 at 06:41:08AM +0000, Jingjing Xu wrote:
> test_so_rcv.sh uses KSFT_FAIL and KSFT_PASS, but lib.sh defines the
> lowercase ksft_fail and ksft_pass constants. With the uppercase variables
> unset, exit has no argument and returns the successful echo status, even
> when the script has reported failed tests.
>
> Use the constants actually provided by lib.sh so failures produce a
> nonzero exit status.
>
> Run as root from tools/testing/selftests/net after building the helpers.
> For the original four-case script, this changes only sender metadata to 1
> while the listeners still expect 2 or 3:
>
> sed '/\.\/cmsg_sender/s/\$arg/${arg% *} 1/' test_so_rcv.sh | bash
> echo $?
>
> Both versions report four failures. The original prints 0 as the exit
> status; with this fix it prints 1.
>
> AI-assisted inspection found this while extending the receive tests.
> With deliberately mismatched sender metadata, all four original cases
> fail on both versions: the original script exits 0 and
> the corrected script exits 1. The unmodified sender passes all four cases
> with exit 0. No kernel instrumentation or fault injection was used.
>
> Fixes: c935af429ec2 ("selftests: net: add support for testing SO_RCVMARK and SO_RCVPRIORITY")
> Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
> ---
> tools/testing/selftests/net/test_so_rcv.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/test_so_rcv.sh b/tools/testing/selftests/net/test_so_rcv.sh
> index d8aa4362879d..ae01fa3c5329 100755
> --- a/tools/testing/selftests/net/test_so_rcv.sh
> +++ b/tools/testing/selftests/net/test_so_rcv.sh
> @@ -66,8 +66,8 @@ done
>
> if [ "$FAILED_TESTS" -ne 0 ]; then
> echo "FAIL - $FAILED_TESTS/$TOTAL_TESTS tests failed"
> - exit ${KSFT_FAIL}
> + exit ${ksft_fail}
> else
> echo "OK - All $TOTAL_TESTS tests passed"
> - exit ${KSFT_PASS}
> + exit ${ksft_pass}
> fi
> base-commit: 57f165ff2f30491bc3511d24a52ca516751a268b
> --
> 2.53.0
>
>
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v2 2/3] selftests: net: enable receive metadata independently of its value
2026-11-25 6:41 [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
2026-11-25 6:41 ` [PATCH net-next v2 1/3] selftests: net: report SO_RCV test failures to the runner Jingjing Xu
@ 2026-11-25 6:41 ` Jingjing Xu
2026-11-25 6:41 ` [PATCH net-next v2 3/3] selftests: net: cover zero receive mark and priority Jingjing Xu
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Jingjing Xu @ 2026-11-25 6:41 UTC (permalink / raw)
To: netdev
Cc: linux-kselftest, kuba, edumazet, pabeni, horms, shuah, willemb,
annaemesenyiri, idosch, hangbin.liu
so_rcv_listener passes the expected mark or priority to setsockopt() as
its SO_RCVMARK or SO_RCVPRIORITY enable flag. Consequently, expecting zero
also disables the ancillary message being tested. A zero mark or priority
is valid, but invoking the listener with -M 0 or -P 0 fails with ENOMSG.
Use a separate nonzero flag to enable reception and keep opt.val solely
for checking the received value.
This issue was found with AI-assisted source review and reproduced using
real UDP sockets. Zero and nonzero mark/priority tests pass over IPv4 and
IPv6 after the fix; the zero cases fail on the original helper.
No kernel instrumentation or fault injection was used.
Fixes: c935af429ec2 ("selftests: net: add support for testing SO_RCVMARK and SO_RCVPRIORITY")
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
---
tools/testing/selftests/net/so_rcv_listener.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/so_rcv_listener.c b/tools/testing/selftests/net/so_rcv_listener.c
index bc5841192aa6..a57fff256cc2 100644
--- a/tools/testing/selftests/net/so_rcv_listener.c
+++ b/tools/testing/selftests/net/so_rcv_listener.c
@@ -65,6 +65,7 @@ static void parse_args(int argc, char *argv[])
int main(int argc, char *argv[])
{
+ int enable = 1;
int err = 0;
int recv_fd = -1;
int ret_value = 0;
@@ -88,7 +89,8 @@ int main(int argc, char *argv[])
goto cleanup;
}
- err = setsockopt(recv_fd, SOL_SOCKET, opt.rcvname, &opt.val, sizeof(opt.val));
+ err = setsockopt(recv_fd, SOL_SOCKET, opt.rcvname,
+ &enable, sizeof(enable));
if (err < 0) {
perror("Recv setsockopt error");
ret_value = -errno;
base-commit: 57f165ff2f30491bc3511d24a52ca516751a268b
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net-next v2 3/3] selftests: net: cover zero receive mark and priority
2026-11-25 6:41 [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
2026-11-25 6:41 ` [PATCH net-next v2 1/3] selftests: net: report SO_RCV test failures to the runner Jingjing Xu
2026-11-25 6:41 ` [PATCH net-next v2 2/3] selftests: net: enable receive metadata independently of its value Jingjing Xu
@ 2026-11-25 6:41 ` Jingjing Xu
2026-11-25 8:36 ` Hangbin Liu
2026-11-30 0:59 ` [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
2026-12-04 2:40 ` patchwork-bot+netdevbpf
4 siblings, 1 reply; 8+ messages in thread
From: Jingjing Xu @ 2026-11-25 6:41 UTC (permalink / raw)
To: netdev
Cc: linux-kselftest, kuba, edumazet, pabeni, horms, shuah, willemb,
annaemesenyiri, idosch, hangbin.liu
Exercise SO_RCVMARK and SO_RCVPRIORITY with zero values as well as the
existing nonzero values, for both IPv4 and IPv6. These cases catch using
the expected metadata value as the ancillary-message enable flag.
With the new tests and the original listener, four of eight cases fail
and the corrected script exits with status 1. With the fixed listener,
all eight pass and the script exits with status 0. The original four
cases also pass with the original listener. Verification used real UDP
sockets in isolated network namespaces; discovery and testing were
AI-assisted. No kernel instrumentation or fault injection was used.
Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
---
tools/testing/selftests/net/test_so_rcv.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/test_so_rcv.sh b/tools/testing/selftests/net/test_so_rcv.sh
index ae01fa3c5329..3263ba2d1a67 100755
--- a/tools/testing/selftests/net/test_so_rcv.sh
+++ b/tools/testing/selftests/net/test_so_rcv.sh
@@ -11,6 +11,8 @@ FAILED_TESTS=0
declare -A TESTS=(
["SO_RCVPRIORITY"]="-P 2"
["SO_RCVMARK"]="-M 3"
+ ["SO_RCVPRIORITY_ZERO"]="-P 0"
+ ["SO_RCVMARK_ZERO"]="-M 0"
)
check_result() {
base-commit: 57f165ff2f30491bc3511d24a52ca516751a268b
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v2 3/3] selftests: net: cover zero receive mark and priority
2026-11-25 6:41 ` [PATCH net-next v2 3/3] selftests: net: cover zero receive mark and priority Jingjing Xu
@ 2026-11-25 8:36 ` Hangbin Liu
0 siblings, 0 replies; 8+ messages in thread
From: Hangbin Liu @ 2026-11-25 8:36 UTC (permalink / raw)
To: Jingjing Xu
Cc: netdev, linux-kselftest, kuba, edumazet, pabeni, horms, shuah,
willemb, annaemesenyiri, idosch
On Wed, Nov 25, 2026 at 06:41:10AM +0000, Jingjing Xu wrote:
> Exercise SO_RCVMARK and SO_RCVPRIORITY with zero values as well as the
> existing nonzero values, for both IPv4 and IPv6. These cases catch using
> the expected metadata value as the ancillary-message enable flag.
>
> With the new tests and the original listener, four of eight cases fail
> and the corrected script exits with status 1. With the fixed listener,
> all eight pass and the script exits with status 0. The original four
> cases also pass with the original listener. Verification used real UDP
> sockets in isolated network namespaces; discovery and testing were
> AI-assisted. No kernel instrumentation or fault injection was used.
>
> Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
> ---
> tools/testing/selftests/net/test_so_rcv.sh | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/net/test_so_rcv.sh b/tools/testing/selftests/net/test_so_rcv.sh
> index ae01fa3c5329..3263ba2d1a67 100755
> --- a/tools/testing/selftests/net/test_so_rcv.sh
> +++ b/tools/testing/selftests/net/test_so_rcv.sh
> @@ -11,6 +11,8 @@ FAILED_TESTS=0
> declare -A TESTS=(
> ["SO_RCVPRIORITY"]="-P 2"
> ["SO_RCVMARK"]="-M 3"
> + ["SO_RCVPRIORITY_ZERO"]="-P 0"
> + ["SO_RCVMARK_ZERO"]="-M 0"
> )
>
> check_result() {
> base-commit: 57f165ff2f30491bc3511d24a52ca516751a268b
> --
> 2.53.0
>
>
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting
2026-11-25 6:41 [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
` (2 preceding siblings ...)
2026-11-25 6:41 ` [PATCH net-next v2 3/3] selftests: net: cover zero receive mark and priority Jingjing Xu
@ 2026-11-30 0:59 ` Jingjing Xu
2026-12-04 2:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 8+ messages in thread
From: Jingjing Xu @ 2026-11-30 0:59 UTC (permalink / raw)
To: netdev; +Cc: kuba, hangbin.liu, linux-kselftest
Hi,
The contest check reports that this series conflicts with pending/net
patches in net-next-2026-11-25--09-00 at test_so_rcv.sh:66.
I checked that all three v2 patches apply in order to the net-next main
at 5eb53a1fbf80 (checked on 2026-11-30). Applying v1 first and then v2 reproduces
the same exit-constant hunk failure locally. Could v1 still be present
in the pending queue? I have not inspected the actual CI queue, so this
is only a possible explanation.
V2 replaces the original two-patch series:
https://lore.kernel.org/netdev/20261122154912.1272447-1-xujingjing@cmss.chinamobile.com/
Please use the three-patch v2 for the receive selftest fixes and coverage.
Thanks,
Jingjing
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting
2026-11-25 6:41 [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
` (3 preceding siblings ...)
2026-11-30 0:59 ` [PATCH net-next v2 0/3] selftests: net: fix receive metadata and failure reporting Jingjing Xu
@ 2026-12-04 2:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-04 2:40 UTC (permalink / raw)
To: Jingjing Xu
Cc: netdev, linux-kselftest, kuba, edumazet, pabeni, horms, shuah,
willemb, annaemesenyiri, idosch, hangbin.liu
Hello:
This series was applied to netdev/net-next.git (main)
by Willem de Bruijn <willemb@google.com>:
On Wed, 25 Nov 2026 06:41:07 +0000 you wrote:
> Separate the failure-status correction from the zero-value tests, as
> requested by Hangbin Liu. The first patch repairs script failure reporting,
> the second enables reception independently of the expected metadata, and
> the third adds the zero mark/priority cases to the existing test.
>
> Changes in v2:
> - Split the exit-constant correction into a standalone fix (Hangbin Liu).
> - Put both fixes before the added regression cases.
> - Retain Hangbin Liu's Reviewed-by only on the receive-enable fix.
> - Wrap that setsockopt() call to stay within 80 columns; behavior unchanged.
> - Rebase onto net-next 57f165ff2f30.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/3] selftests: net: report SO_RCV test failures to the runner
https://git.kernel.org/netdev/net-next/c/f7bf67e60111
- [net-next,v2,2/3] selftests: net: enable receive metadata independently of its value
https://git.kernel.org/netdev/net-next/c/1eaa40156889
- [net-next,v2,3/3] selftests: net: cover zero receive mark and priority
https://git.kernel.org/netdev/net-next/c/c73c7be6cf0c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread