From: sashiko-bot@kernel.org
To: "Jakub Sitnicki" <jakub@cloudflare.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 07/14] selftests/bpf: Test skb_ext read from cgroup_skb and sk_filter hooks
Date: Sat, 15 Aug 2026 08:14:52 +0000 [thread overview]
Message-ID: <20260815081452.A6B381F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814-bpf-meta-inside-skb-ext-v1-7-767edd862656@cloudflare.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Implicit truncation of error code to unsigned short masks get_socket_local_port() failure.
--
--- Patch [7]: [PATCH net-next 07/14] selftests/bpf: Test skb_ext read from cgroup_skb and sk_filter hooks ---
commit b524b9baad48611cd0f3fbe2f1b770ea85d7c5df
Author: Jakub Sitnicki <jakub@cloudflare.com>
selftests/bpf: Test skb_ext read from cgroup_skb and sk_filter hooks
This commit extends the skb_ext cross-hook coverage to UDP readers. It attaches
a TC ingress program on loopback to write the extension, sends a UDP datagram,
and reads the extension back from a cgroup_skb/ingress program and a socket
filter.
> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
> index de60303025361..808eb158fe0f1 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
[ ... ]
> +/* Send test_payload over loopback UDP to recv_fd */
> +static int send_loopback_udp(int recv_fd)
> +{
> + struct sockaddr_in addr = {
> + .sin_family = AF_INET,
> + .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
> + };
> + char buf[TEST_PAYLOAD_LEN];
> + int ret = -1;
> + int fd = -1;
> + __be16 port;
> +
> + port = get_socket_local_port(recv_fd);
> + if (!ASSERT_GE(port, 0, "get_port"))
> + goto out;
[Severity: Medium]
Will this error check ever trigger if get_socket_local_port() fails?
Because port is declared as a __be16 (an unsigned 16-bit integer), a -1 return
value from get_socket_local_port() would be implicitly truncated and converted
to 65535.
The ASSERT_GE(port, 0, ...) check would then compare 65535 >= 0, which is always
true. This masks the failure and allows the test to proceed with an invalid
port.
Should the return value be captured in an int variable for the error check
before assigning it to the __be16 port?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814-bpf-meta-inside-skb-ext-v1-0-767edd862656@cloudflare.com?part=7
next prev parent reply other threads:[~2026-08-15 8:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 8:14 [PATCH net-next 00/14] skb extension for BPF metadata Jakub Sitnicki
2026-08-14 8:14 ` [PATCH net-next 01/14] bpf: Introduce per-packet metadata storage for BPF programs Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 02/14] bpf: Allow access to bpf_sock_ops_kern->skb Jakub Sitnicki
2026-08-14 8:14 ` [PATCH net-next 03/14] bpf: Make BPF skb extension survive packet scrubbing Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 04/14] selftests/bpf: Add tests for bpf_dynptr_from_skb_ext Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 05/14] selftests/bpf: Test skb_ext on cloned skbs Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 06/14] selftests/bpf: Test skb_ext survival across veth and GRE Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 07/14] selftests/bpf: Test skb_ext read from cgroup_skb and sk_filter hooks Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot [this message]
2026-08-14 8:14 ` [PATCH net-next 08/14] selftests/bpf: Test skb_ext read from sock_ops and LSM hooks Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 09/14] selftests/bpf: Test skb_ext read from kfree_skb tracepoint Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 10/14] selftests/bpf: Test skb_ext read from netfilter hook Jakub Sitnicki
2026-08-14 8:14 ` [PATCH net-next 11/14] selftests/bpf: Test skb_ext from LWT in, out, and xmit hooks Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 12/14] selftests/bpf: Test skb_ext read from seg6local End.BPF hook Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 13/14] selftests/bpf: Test skb_ext read from sk_skb stream verdict hook Jakub Sitnicki
2026-08-15 8:14 ` sashiko-bot
2026-08-14 8:14 ` [PATCH net-next 14/14] selftests/bpf: Use non-trivial test payload in xdp_context tests 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=20260815081452.A6B381F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--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.