From: sashiko-bot@kernel.org
To: "Kuniyuki Iwashima" <kuniyu@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v4 bpf-next 10/10] selftest: bpf: Add test for bpf_tcp_ops.{enqueue,dequeue}_rcvq().
Date: Tue, 06 Oct 2026 19:43:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-162406@kernel.org> (raw)
In-Reply-To: <20261006192601.1875100-11-kuniyu@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftest: bpf: tcp_autolowat missing rpc_desc_buff_len reset
--
commit 379ea90d2efb24d101b9be64b55e86c49d5beee6
Author: Kuniyuki Iwashima <kuniyu@google.com>
selftest: bpf: Add test for bpf_tcp_ops.{enqueue,dequeue}_rcvq().
This commit introduces a BPF selftest to verify the behavior of the
bpf_tcp_ops enqueue and dequeue callbacks dynamically adjusting sk_rcvlowat
for RPC frames. It sets up a client-server connection within a cgroup and
uses setsockopt with a custom BPF option to enable TCP AutoLOWAT.
> diff --git a/tools/testing/selftests/bpf/progs/tcp_autolowat.c b/tools/testing/selftests/bpf/progs/tcp_autolowat.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/tcp_autolowat.c
[ ... ]
> +static int tcp_init_autolowat_cb(struct bpf_tcp_sock *btp)
> +{
> + struct tcp_autolowat_cb *cb;
> + struct tcp_sock *tp;
> +
> + cb = bpf_sk_storage_get(&tcp_autolowat_map, btp, 0,
> + BPF_SK_STORAGE_GET_F_CREATE);
> + if (!cb)
> + return -1;
> +
> + tp = bpf_core_cast(btp, struct tcp_sock);
> +
> + cb->rpc_desc_seq = tp->copied_seq;
> + cb->rpc_end_seq = tp->copied_seq;
> +#ifdef DEBUG
> + cb->isn = tp->copied_seq;
> +#endif
> +
[Severity: Medium]
Should cb->rpc_desc_buff_len be reset to 0 here as well?
If an application re-initializes parsing by calling setsockopt again on
the same socket, tcp_init_autolowat_cb() resets the sequence numbers but
leaves the buffer length intact. If the storage entry already existed
from a previous operation that had read a partial RPC descriptor, the stale
parser state will persist and could corrupt the next parse operation.
> + return bpf_tcp_ops_set_flags((struct tcp_sock *)btp,
> + BPF_TCP_OPS_FLAG_RCVQ, 0);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006192601.1875100-1-kuniyu@google.com?part=10
next prev parent reply other threads:[~2026-10-06 19:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 19:24 [PATCH v4 bpf-next 00/10] bpf: Add bpf_tcp_ops hooks for TCP AutoLOWAT Kuniyuki Iwashima
2026-10-06 19:24 ` [PATCH v4 bpf-next 01/10] bpf: tcp: Convert deny-list for bpf_{get,set}sockopt() to allow-list Kuniyuki Iwashima
2026-10-06 23:09 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 02/10] bpf: tcp: Add a new per-socket flag and kfunc for bpf_tcp_ops Kuniyuki Iwashima
2026-10-06 22:04 ` Stanislav Fomichev
2026-10-06 23:10 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 03/10] selftest: bpf: Use bpf_tcp_ops_set_flags() in bpf_tcp_ops_hdr.c Kuniyuki Iwashima
2026-10-06 22:04 ` Stanislav Fomichev
2026-10-06 23:12 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 04/10] bpf: tcp: Guard fast-path bpf_tcp_ops_call() under per-socket flag Kuniyuki Iwashima
2026-10-06 22:05 ` Stanislav Fomichev
2026-10-06 23:25 ` Amery Hung
2026-10-07 2:48 ` Kuniyuki Iwashima
2026-10-07 22:36 ` Amery Hung
2026-10-08 2:10 ` Kuniyuki Iwashima
2026-10-06 19:24 ` [PATCH v4 bpf-next 05/10] bpf: tcp: Check BPF_SOCK_OPS_TEST_FLAG() after cgroup_bpf_enabled(CGROUP_SOCK_OPS) Kuniyuki Iwashima
2026-10-06 20:11 ` bot+bpf-ci
2026-10-06 22:05 ` Stanislav Fomichev
2026-10-07 22:38 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 06/10] bpf: tcp: Introduce bpf_tcp_ops.{enqueue,dequeue}_rcvq() Kuniyuki Iwashima
2026-10-06 22:06 ` Stanislav Fomichev
2026-10-06 23:26 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 07/10] tcp: Split out __tcp_set_rcvlowat() Kuniyuki Iwashima
2026-10-07 22:43 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 08/10] bpf: mptcp: Don't support BPF_TCP_OPS_FLAG_RCVQ Kuniyuki Iwashima
2026-10-06 22:06 ` Stanislav Fomichev
2026-10-07 22:43 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 09/10] bpf: tcp: Add kfunc to adjust sk->sk_rcvlowat Kuniyuki Iwashima
2026-10-06 19:42 ` sashiko-bot
2026-10-07 23:06 ` Amery Hung
2026-10-07 23:21 ` Kuniyuki Iwashima
2026-10-07 23:42 ` Amery Hung
2026-10-06 19:24 ` [PATCH v4 bpf-next 10/10] selftest: bpf: Add test for bpf_tcp_ops.{enqueue,dequeue}_rcvq() Kuniyuki Iwashima
2026-10-06 19:43 ` sashiko-bot [this message]
2026-10-06 22:06 ` Stanislav Fomichev
2026-10-07 13:11 ` [PATCH v4 bpf-next 00/10] bpf: Add bpf_tcp_ops hooks for TCP AutoLOWAT 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=sashiko-outbox-162406@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kuniyu@google.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.