All of lore.kernel.org
 help / color / mirror / Atom feed
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 01/15] xdp: Let memory providers offer XDP a view of their net_iovs
Date: Wed, 25 Nov 2026 13:00:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-233411@kernel.org> (raw)
In-Reply-To: <20261124125654.183091-1-bjorn@kernel.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] bpf: missing IS_ERR() check on bpf_xdp_pointer() in
  bpf_dynptr_slice() [1]
--

commit c810409b8d143cccffd67910e9b5cc0e3963ba70
Author: Björn Töpel <bjorn@kernel.org>

xdp: Let memory providers offer XDP a view of their net_iovs

This commit adds an optional XDP virtual address view to net_iov_area and
introduces xdp_netmem_address() and xdp_frag_address() so XDP helpers can
read and write provider-backed net_iovs when a view is present.

> diff --git a/net/core/filter.c b/net/core/filter.c
> index f42ecfb5841f9..d5774b2577e72 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4310,7 +4310,7 @@ void bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned long off,
>  			break;
>  
>  		ptr_off += ptr_len;
> -		ptr_buf = skb_frag_address(next_frag);
> +		ptr_buf = xdp_frag_address(next_frag);
>  		ptr_len = skb_frag_size(next_frag);
>  		next_frag++;
>  	}

[Severity: High]
This problem wasn't introduced by this patch, but can bpf_xdp_copy_buf()
walk uninitialized sinfo->frags and dereference wild pointers in
xdp_frag_address() when bpf_dynptr_slice() ignores an ERR_PTR() return from
bpf_xdp_pointer() [1]?

kernel/bpf/helpers.c:bpf_dynptr_slice() {
    ...
	case BPF_DYNPTR_TYPE_XDP:
	{
		void *xdp_ptr = bpf_xdp_pointer(ptr->data, ptr->offset + offset, len);
		if (!IS_ERR_OR_NULL(xdp_ptr))
			return xdp_ptr;

		if (!buffer__nullable)
			return NULL;
		bpf_xdp_copy_buf(ptr->data, ptr->offset + offset, buffer__nullable, len, false);
		return buffer__nullable;
	}
    ...
}

bpf_dynptr_from_xdp() caches the initial packet length in ptr->size, which
becomes stale if the packet is shrunk with bpf_xdp_adjust_tail().  A slice
request within the old size but past the new length passes
bpf_dynptr_check_off_len() and causes bpf_xdp_pointer() to return
ERR_PTR(-EINVAL).  When buffer__nullable is non-NULL, bpf_dynptr_slice()
Still calls bpf_xdp_copy_buf(), which assumes fragments exist whenever
off + len exceeds the linear area and reads uninitialized
skb_shared_info->frags on a single-buffer xdp_buff.

[1] https://sashiko.dev/#/bug/linux-aa57c490-a988-47e9-b527-87c8137088ea

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124112707.118678-1-bjorn@kernel.org?part=1

  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 [this message]
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
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-233411@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.