BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michal Luczaj" <mhal@rbox.co>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 3/4] selftests/bpf: Adapt sockmap update error handling
Date: Fri, 26 Jun 2026 20:43:22 +0000	[thread overview]
Message-ID: <20260626204322.E76D91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626-sockmap-lookup-udp-leak-v2-3-7e7e201c951a@rbox.co>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Low] Usage of legacy FAIL_ERRNO / CHECK_FAIL macros in updated tests instead of modern ASSERT_* macros.
--

commit bc0e5d743f397cf1347e049495ba4a7950323606
Author: Michal Luczaj <mhal@rbox.co>

selftests/bpf: Adapt sockmap update error handling

This patch updates sockmap_listen to accommodate recent changes in sockmap
that reject unbound UDP sockets.

> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> index cc0c68bab9079..6ee1bc6b3b235 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> @@ -63,11 +63,8 @@ static void test_insert_opened(struct test_sockmap_listen *skel __always_unused,
>  	errno = 0;
>  	value = s;
>  	err = bpf_map_update_elem(mapfd, &key, &value, BPF_NOEXIST);
> -	if (sotype == SOCK_STREAM) {
> -		if (!err || errno != EOPNOTSUPP)
> -			FAIL_ERRNO("map_update: expected EOPNOTSUPP");
> -	} else if (err)
> -		FAIL_ERRNO("map_update: expected success");
> +	if (!err || errno != EOPNOTSUPP)
> +		FAIL_ERRNO("map_update: expected EOPNOTSUPP");

[Severity: Low]
This is a pre-existing issue, but since this block in test_insert_opened() is
being updated, should these deprecated FAIL_ERRNO() macros be migrated to the
modern ASSERT_*() macros? The BPF selftests subsystem guidelines prefer using
ASSERT_* macros when updating existing tests.

[ ... ]

> @@ -93,8 +90,12 @@ static void test_insert_bound(struct test_sockmap_listen *skel __always_unused,
>  	errno = 0;
>  	value = s;
>  	err = bpf_map_update_elem(mapfd, &key, &value, BPF_NOEXIST);
> -	if (!err || errno != EOPNOTSUPP)
> -		FAIL_ERRNO("map_update: expected EOPNOTSUPP");
> +	if (sotype == SOCK_STREAM) {
> +		if (!err || errno != EOPNOTSUPP)
> +			FAIL_ERRNO("map_update: expected EOPNOTSUPP");
> +	} else if (err) {
> +		FAIL_ERRNO("map_update: expected success");
> +	}

[Severity: Low]
This isn't a bug introduced by this patch, but would it make sense to replace
these FAIL_ERRNO() checks in test_insert_bound() with ASSERT_ERR() or similar
modern macros while refactoring this logic?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260626-sockmap-lookup-udp-leak-v2-0-7e7e201c951a@rbox.co?part=3

  reply	other threads:[~2026-06-26 20:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 20:36 [PATCH bpf v2 0/4] bpf, sockmap: Fix sockmap leaking UDP socks Michal Luczaj
2026-06-26 20:36 ` [PATCH bpf v2 1/4] bpf, sockmap: Reject unhashed UDP sockets on sockmap update Michal Luczaj
2026-06-26 20:45   ` Kuniyuki Iwashima
2026-06-26 20:58   ` sashiko-bot
2026-06-28 21:59     ` Michal Luczaj
2026-06-29 11:37       ` Jakub Sitnicki
2026-06-29 21:40         ` Michal Luczaj
2026-07-01 10:04           ` Jakub Sitnicki
2026-07-01 22:58             ` John Fastabend
2026-07-01 23:19               ` Michal Luczaj
2026-06-29 11:38   ` Jakub Sitnicki
2026-07-01 22:59     ` John Fastabend
2026-06-26 20:36 ` [PATCH bpf v2 2/4] selftests/bpf: Ensure UDP sockets are bound Michal Luczaj
2026-06-26 20:47   ` Kuniyuki Iwashima
2026-06-28 21:58     ` Michal Luczaj
2026-06-26 20:36 ` [PATCH bpf v2 3/4] selftests/bpf: Adapt sockmap update error handling Michal Luczaj
2026-06-26 20:43   ` sashiko-bot [this message]
2026-06-28 21:58     ` Michal Luczaj
2026-06-26 20:58   ` Kuniyuki Iwashima
2026-06-28 21:59     ` Michal Luczaj
2026-06-26 21:14   ` bot+bpf-ci
2026-06-26 20:36 ` [PATCH bpf v2 4/4] selftests/bpf: Fail unbound UDP on sockmap update Michal Luczaj
2026-06-26 20:41   ` sashiko-bot
2026-06-28 21:58     ` Michal Luczaj
2026-06-26 21:03   ` Kuniyuki Iwashima
2026-07-01 23:19     ` Michal Luczaj
2026-06-27 17:34 ` [PATCH bpf v2 0/4] bpf, sockmap: Fix sockmap leaking UDP socks sun jian
2026-06-28 22:00   ` Michal Luczaj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260626204322.E76D91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=mhal@rbox.co \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox