From: sashiko-bot@kernel.org
To: "Michal Luczaj" <mhal@rbox.co>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 4/4] selftests/bpf: Fail unbound UDP on sockmap update
Date: Fri, 26 Jun 2026 20:41:25 +0000 [thread overview]
Message-ID: <20260626204125.C75961F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626-sockmap-lookup-udp-leak-v2-4-7e7e201c951a@rbox.co>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing check for `socket()` failure leads to a false positive test pass.
--
commit 7f8484db13c3ae1f9676009ab7e283f2b68e4ae0
Author: Michal Luczaj <mhal@rbox.co>
selftests/bpf: Fail unbound UDP on sockmap update
This commit modifies test_maps to expect a failure when updating a sockmap
with an unbound UDP socket. It effectively reverts a previous selftests
change now that sockmap rejects unbound UDP sockets.
> diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
> --- a/tools/testing/selftests/bpf/test_maps.c
> +++ b/tools/testing/selftests/bpf/test_maps.c
> @@ -759,12 +759,12 @@ static void test_sockmap(unsigned int tasks, void *data)
> goto out_sockmap;
> }
>
> - /* Test update with unsupported UDP socket */
> + /* Test update with unsupported unbound UDP socket */
> udp = socket(AF_INET, SOCK_DGRAM, 0);
> i = 0;
> err = bpf_map_update_elem(fd, &i, &udp, BPF_ANY);
[Severity: Medium]
Will test_sockmap() in tools/testing/selftests/bpf/test_maps.c now silently
pass if socket() fails to create a file descriptor?
Because this patch changes the logic to expect an error from
bpf_map_update_elem() by checking if (!err), if socket() returns -1 due to
setup failures, bpf_map_update_elem() will fail with an error like -EBADF.
This would cause the test to erroneously pass without actually testing the
kernel's behavior for unbound UDP sockets. Does this test need a check to
ensure the returned udp file descriptor is valid before proceeding with the
map update?
> - if (err) {
> - printf("Failed socket update SOCK_DGRAM '%i:%i'\n",
> + if (!err) {
> + printf("Failed allowed unbound SOCK_DGRAM socket update '%i:%i'\n",
> i, udp);
> goto out_sockmap;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260626-sockmap-lookup-udp-leak-v2-0-7e7e201c951a@rbox.co?part=4
next prev parent reply other threads:[~2026-06-26 20:41 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
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 [this message]
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=20260626204125.C75961F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.