🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3962

Re: [PATCH v3] xsk: fix memory corruptions in net/core/xdp.c

#3962
From: Björn Töpel
Date: Fri, 16 Oct 2026 11:19
49 lines
6860 bytes
Waking a dead thread: RISE FROM YOUR GRAVE!

Clement Lecigne <clecigne@google.com> writes:

> From: Clément Lecigne <clecigne@google.com>
>
> Commit 560d958c6c68 ("xsk: add generic XSk &xdp_buff -> skb conversion")
> introduced a vulnerability in the handling of XDP_PASS for AF_XDP zero-copy
> frames.

Hmm, I acually hit this in my WIP for UMEM page pool provider hack.

> Note: Currently, this specific AF_XDP zero-copy conversion path is only
> reachable from the drivers/net/ethernet/intel/ice and
> drivers/net/ethernet/intel/idpf drivers.
>
> When building an skb, xdp_build_skb_from_zc() uses the chunk size
> (xdp->frame_sz) for the allocation. However, napi_build_skb() automatically
> reserves space at the end of the allocation for the skb_shared_info
> structure. 
>
> Most high performance UMEM applications use 4K chunks, where the
> corruption cannot happen.

I think this can also happen with 4K UMEM chunks.

For example, on ice, use MTU 3800, 4K chunks, and no extra UMEM
headroom. Attach an xdp.frags program that returns XDP_PASS, and bind
the socket without XDP_USE_SG.

A 3814-byte Ethernet frame fits in the UMEM chunk:

  256 headroom + 3814 packet = 4070 bytes

But the copied skb also needs space for skb_shared_info. Using
the 320-byte size from your example:

  256 headroom + 3814 packet + 320 shared info = 4390 bytes

The old code allocates only 4096 bytes, so the packet copy
overwrites skb_shared_info.

Am I missing something?


Björn
Technical Details
Message-ID: <87qzhp51vc.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347301-linux-kernel-netdev=dewy.ru
References: <20260629072300.1664622-1-clecigne@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347301-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v3] xsk: fix memory corruptions in net/core/xdp.c
Date: Fri, 16 Oct 2026 13:19:35 +0200
Organization: Usenet Network
Message-ID: <87qzhp51vc.fsf@all.your.base.are.belong.to.us>
References: <20260629072300.1664622-1-clecigne@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="2749373"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:IkgWtXP/bTqJLjLAp4qhnZdId+M= sha256:gPd9eoenkHpuw947pObdgewo4TQJ/ZdAGYKVY9zj5r0=
	sha1:pn9kVbk4Hf1Hfmp60Du0hc/wQq0= sha256:QB64r/dI67blZE7SpJoqEs4wvRQOZBos40vsJ/fxY9w=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 2690F11050B; Fri, 16 Oct 2026 14:21:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.34
X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Ijvk1_3xAeWY;
	Fri, 16 Oct 2026 14:21:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-347301-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A1B70110506; Fri, 16 Oct 2026 14:21:47 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 7C37137EE8; Fri, 16 Oct 2026 11:19:40 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 71A5A443C16;
	Fri, 16 Oct 2026 11:19:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GSZ/aODB"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74A553D812D;
	Fri, 16 Oct 2026 11:19:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792149579; cv=none; b=V6isaUECN2eawckCSQFwl0olVajrF7ITQ/VOp+/AQjWcidfdaZggQEvOp2o9qOM+OqTuv9bItLZV8YrENMvUtawnK12OZSBJjv1EwX3+txSTc1BwdOOxb1Wt1uE1WrX9jyGyC9h4fwfRQVETkKfB5FeiC5ZhONs8awGhoXuubY4=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792149579; c=relaxed/simple;
	bh=bISYE32Keboph/NFLD7Q56AYqXzzo4A+4qsxWw0jSfc=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
	 MIME-Version:Content-Type; b=EvcDhhNaJx81OPGUrAbUQ/5qZiWzvM6ConcaoIDrlhQ4gZlBPOOYSUYaW/thhSkDkzaD+OpKf4JmSrGJdBCNdYHiED4+SfWzOUoddNVvxbrWTz5X6pOXMNjac8tiTmsBDO9BBIDIV5G4YNoTT42QrZk/DWeM9tGv3nEwMiU4mD8=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GSZ/aODB; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF8141F000C4;
	Fri, 16 Oct 2026 11:19:37 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792149578;
	bh=miFPUobfnaeUFZw7U7GalciH9GRDPp4unu/aa9PhnKE=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=GSZ/aODBboUbiYkksQCGe0Lc331lPG6ylfhUjH9mf4IrJL7JL60l+wppkr1u2qCJF
	 qkhd098NKAKFf7sIkiDnxofGPrRlVW8xwRJqE55NBaJlj+etNWiXeKoJNCdEORp9RA
	 Vwo/m2xF6ZtjOLg7tseNh3oiIzJXkMh4KPWKGphgLFUhQs40E6VkjMpJ41SZE09xks
	 sPwREe2sr+iJlnIP1V3f0j8fhCDnDMWR8riDM4+zYazw0VcEY51o33XgB9DB89Il8A
	 b0nkcOwoAmYOgl9cDgGDDwiQbvoPvIu2euUH5RDVdTrjS4BLiuPCiS4sWzsuIrOlUo
	 XzpAu+uQXplEw==
X-Cc: clecigne@google.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
 kuba@kernel.org, sdf@fomichev.me, horms@kernel.org,
 john.fastabend@gmail.com, ast@kernel.org, daniel@iogearbox.net
X-In-Reply-To: <20260629072300.1664622-1-clecigne@google.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>