From: sashiko-bot@kernel.org
To: "Björn Töpel" <bjorn@kernel.org>, bpf@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next 05/15] xdp: Run programs on buffers that must not hold kernel structures
Date: Wed, 25 Nov 2026 13:00:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-233415@kernel.org> (raw)
In-Reply-To: <20261124125654.183091-5-bjorn@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] xdp: missing bpf_syncookie_th() allows double-fetch OOB read on
sink buffers
--
commit b4ad66c3d86af2bd4e09e9ce63f3109fcc6d6fe8
Author: Björn Töpel <bjorn@kernel.org>
xdp: Run programs on buffers that must not hold kernel structures
This commit allows native XDP programs to run on AF_XDP sink buffers by
marking them with XDP_FLAGS_SINK and XDP_FLAGS_SINFO_EXT, keeping shared
info in the queue and preventing frame or skb construction in the buffer.
> diff --git a/include/net/xdp.h b/include/net/xdp.h
> index 944418111a86e..c7cb0ba4e16f4 100644
> --- a/include/net/xdp.h
> +++ b/include/net/xdp.h
[ ... ]
> @@ -95,6 +99,15 @@ enum xdp_buff_flags {
> * frame, see xdp_data_hard_end(): the frame must hold nothing else.
> */
> XDP_FLAGS_SINFO_EXT = BIT(3),
> + /* AF_XDP sink memory, see %MP_XDP_ONLY: the buffer may only go to the
> + * AF_XDP socket of its queue. Userspace may write it at any time,
> + * also while the kernel reads it. So the kernel takes bounds only
> + * from its own fields, and only the XDP program and its helpers read
> + * the bytes. A helper that checks bytes and reads them again later
> + * must check a copy, see bpf_syncookie_th(). Nothing builds a frame
> + * or an skb in the buffer.
> + */
> + XDP_FLAGS_SINK = BIT(4),
> };
[Severity: High]
Is bpf_syncookie_th() missing from this commit?
bpf_tcp_gen_syncookie(), bpf_tcp_raw_gen_syncookie_ipv4() and
bpf_tcp_raw_gen_syncookie_ipv6() still validate th->doff in place on the
live packet buffer and pass th to tcp_parse_mss_option(), which re-reads
th->doff to bound its option loop:
net/core/filter.c:bpf_tcp_raw_gen_syncookie_ipv4() {
if (unlikely(th_len < sizeof(*th) || th_len != th->doff * 4))
return -EINVAL;
mss = tcp_parse_mss_option(th, 0) ?: TCP_MSS_DEFAULT;
}
net/ipv4/tcp_input.c:tcp_parse_mss_option() {
const unsigned char *ptr = (const unsigned char *)(th + 1);
int length = (th->doff * 4) - sizeof(struct tcphdr);
while (length > 0) {
}
If userspace increases th->doff in the UMEM buffer between the two reads,
tcp_parse_mss_option() reads up to 40 bytes past th + th_len, which can
fault past the end of the UMEM kernel mapping.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124112707.118678-1-bjorn@kernel.org?part=5
next prev parent reply other threads:[~2026-11-25 13:00 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 11:26 [PATCH net-next 00/15] xsk: Receive in the device's buffer layout Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 01/15] xdp: Let memory providers offer XDP a view of their net_iovs Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:07 ` netdev-bot+sashiko
2026-11-25 19:34 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 02/15] xdp: Keep the shared info of a buffer in kernel memory Björn Töpel
2026-11-25 14:07 ` netdev-bot+sashiko
2026-11-25 19:39 ` Björn Töpel
2026-11-25 15:17 ` Maciej Fijalkowski
2026-11-25 19:36 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 03/15] net: Add memory providers that only feed XDP Björn Töpel
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 19:43 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 04/15] page_pool: Let memory providers take back net_iovs Björn Töpel
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 19:45 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 05/15] xdp: Run programs on buffers that must not hold kernel structures Björn Töpel
2026-11-25 13:00 ` sashiko-bot [this message]
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 19:55 ` Björn Töpel
2026-11-25 15:22 ` Maciej Fijalkowski
2026-11-25 15:28 ` Maciej Fijalkowski
2026-11-25 19:50 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 06/15] xsk: Lend UMEM chunks to the page pools of a queue Björn Töpel
2026-11-24 14:34 ` Magnus Karlsson
2026-11-24 15:12 ` Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 20:02 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 07/15] xsk: Deliver to the socket in the device's buffer layout Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 20:11 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 08/15] xsk: Receive " Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 20:16 ` Björn Töpel
2026-11-30 14:47 ` Maciej Fijalkowski
2026-11-24 12:56 ` [PATCH net-next 09/15] eth: fbnic: Support XDP redirect Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 10/15] eth: fbnic: Receive into XDP-only memory providers Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 11/15] net: Add netif_rxq_has_xdp_only_mp() Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 12/15] eth: mlx5e: Receive into XDP-only memory providers Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 20:26 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 13/15] eth: bnxt: " Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 20:33 ` Björn Töpel
2026-11-24 12:56 ` [PATCH net-next 14/15] selftests: net: xsk: Test the device's RX buffer layout Björn Töpel
2026-11-25 13:00 ` sashiko-bot
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-24 12:56 ` [PATCH net-next 15/15] Documentation: networking: Describe AF_XDP RX in the device's layout Björn Töpel
2026-11-25 14:08 ` netdev-bot+sashiko
2026-11-25 13:00 ` [PATCH net-next 00/15] xsk: Receive in the device's buffer layout sashiko-bot
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-233415@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--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.