All of lore.kernel.org
 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 v3 4/4] selftests/bpf: Fail unbound UDP on sockmap update
Date: Wed, 01 Jul 2026 23:34:46 +0000	[thread overview]
Message-ID: <20260701233446.DC20B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702-sockmap-lookup-udp-leak-v3-4-ff8de8782468@rbox.co>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch uses the deprecated `CHECK()` macro instead of the required `ASSERT_*()` macros.
--

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

selftests/bpf: Fail unbound UDP on sockmap update

This commit adjusts test_maps to reflect that sockmap now rejects unbound UDP
sockets. It also checks the return value of socket() when creating the test
socket.

> diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
> index c32da7bd8be27..6a2641ee78975 100644
> --- a/tools/testing/selftests/bpf/test_maps.c
> +++ b/tools/testing/selftests/bpf/test_maps.c
[ ... ]
> @@ -759,16 +759,15 @@ 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);
> -	if (err) {
> -		printf("Failed socket update SOCK_DGRAM '%i:%i'\n",
> -		       i, udp);
> +	CHECK(udp < 0, "socket(AF_INET, SOCK_DGRAM)", "errno:%d\n", errno);

[Severity: Low]
This isn't a bug, but should this new code use the modern ASSERT_OK_FD()
macro rather than the deprecated CHECK() macro?

> +	err = bpf_map_update_elem(fd, &(int){0}, &udp, BPF_ANY);
> +	close(udp);
> +	if (!err) {
> +		printf("Unexpectedly succeeded unbound UDP update '0:%i'\n", udp);
>  		goto out_sockmap;
>  	}
> -	close(udp);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260702-sockmap-lookup-udp-leak-v3-0-ff8de8782468@rbox.co?part=4

  reply	other threads:[~2026-07-01 23:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 23:28 [PATCH bpf v3 0/4] bpf, sockmap: Fix sockmap leaking UDP socks Michal Luczaj
2026-07-01 23:28 ` [PATCH bpf v3 1/4] selftests/bpf: Ensure UDP sockets are bound Michal Luczaj
2026-07-02 10:35   ` Jakub Sitnicki
2026-07-01 23:28 ` [PATCH bpf v3 2/4] bpf, sockmap: Reject unhashed UDP sockets on sockmap update Michal Luczaj
2026-07-01 23:55   ` sashiko-bot
2026-07-02  7:30     ` Michal Luczaj
2026-07-01 23:28 ` [PATCH bpf v3 3/4] selftests/bpf: Adapt sockmap update error handling Michal Luczaj
2026-07-02  0:00   ` bot+bpf-ci
2026-07-02  7:30     ` Michal Luczaj
2026-07-02 10:52   ` Jakub Sitnicki
2026-07-01 23:28 ` [PATCH bpf v3 4/4] selftests/bpf: Fail unbound UDP on sockmap update Michal Luczaj
2026-07-01 23:34   ` sashiko-bot [this message]
2026-07-02  7:30     ` Michal Luczaj
2026-07-02 11:01   ` Jakub Sitnicki

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=20260701233446.DC20B1F000E9@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.