From mboxrd@z Thu Jan 1 00:00:00 1970 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 9A40D345EB9; Sat, 12 Sep 2026 15:38:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789227536; cv=none; b=hn/f/JAVSOD5v+h/qXkbuhxC/xuh6sR+otkX6GEpZu3YuggZ9OT4DlYVk/z8GRojs1oNdRtaJRtZ9YR3OQYDRYxp0VVQbLPkhhsHCSRZV+Fjje6XTVfVuIW/OD/RhCH0+sQOT6EmYE8n6XhyEz4+apYfW/U0F7/RU08lCkW7q4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789227536; c=relaxed/simple; bh=gC7KAYGaETEbgYatp7GAzvOo4V/xmx3/QruZLw1JYCc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AKkoENj011L7r4WcWqX85KHI80iTqFZ9s5kjMg9E6IohIS/v4RuZyJO6URA7mjoOVqvWmMQXehoQE4MqBqMs1TmbsSbU+V+fQGZtFaPSiZxvZ8PS533MO6XFX0g4NGm1ssqw1Dlhdh1iC3nejFBnovE/1W4xpZCESZmwhalQ3mU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Qng+uNrT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Qng+uNrT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF981F000FF; Sat, 12 Sep 2026 15:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789227535; bh=TngAYoI2xDt2++yOhLG4bEluiFpvrxtS7AyhsuHAAx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Qng+uNrT3waIOixefRoINhiy0NJWFlLTcXTKHIVl9Xmj2yJEpbHSpt2D93Pm0TQ+H Wp08RQd/4mAvQ/XdD01o6L+iWgFD9JQn/k/3+l5ZXZUXgUL+aF0/RANEmZI1dKXXx3 BuS/VhP4MdGwjKzdzxebIMkg1jAUKX/b0S5YB/D8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiang Mei , Weiming Shi , Jakub Kicinski Subject: [PATCH 6.1 0202/1191] xdp: fix zero-copy frame layout Date: Sat, 12 Sep 2026 08:48:50 +0200 Message-ID: <20260912065552.749269751@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Weiming Shi commit 71283aaa6c65b3cec84caf1dc78560985737641f upstream. xdp_convert_zc_to_xdp_frame() clones an XSK packet into an order-0 page and advertises PAGE_SIZE as its frame size. It allows the copied frame to occupy the page tail needed by skb_shared_info and records zero headroom even when metadata separates the frame header from packet data. An AF_XDP zero-copy packet redirected through cpumap can therefore make the skb overlap skb_shared_info or place it beyond the allocated page. Limit the copied layout to SKB_WITH_OVERHEAD(PAGE_SIZE) and include the metadata length in frame headroom. Redirect callers already handle a NULL conversion result. BUG: KASAN: slab-out-of-bounds in skb_gro_receive Write of size 4 at addr ffff88800cf37004 by task cpumap/1/map:1/146 Call Trace: skb_gro_receive (net/core/gro.c:174) udp_gro_receive (net/ipv4/udp_offload.c:812) inet_gro_receive (net/ipv4/af_inet.c:1539) dev_gro_receive (net/core/gro.c:515) gro_receive_skb (net/core/gro.c:633) cpu_map_kthread_run (kernel/bpf/cpumap.c:395) kthread (kernel/kthread.c:436) ret_from_fork (arch/x86/kernel/process.c:164) ret_from_fork_asm (arch/x86/entry/entry_64.S:255) Kernel panic - not syncing: KASAN: panic_on_warn set ... Fixes: b0d1beeff2a9 ("xdp: implement convert_to_xdp_frame for MEM_TYPE_ZERO_COPY") Cc: stable@vger.kernel.org Reported-by: Xiang Mei Signed-off-by: Weiming Shi Link: https://patch.msgid.link/20260818154516.793517-1-bestswngs@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/xdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/xdp.c +++ b/net/core/xdp.c @@ -562,7 +562,7 @@ struct xdp_frame *xdp_convert_zc_to_xdp_ xdp->data - xdp->data_meta; totsize = xdp->data_end - xdp->data + metasize; - if (sizeof(*xdpf) + totsize > PAGE_SIZE) + if (sizeof(*xdpf) + totsize > SKB_WITH_OVERHEAD(PAGE_SIZE)) return NULL; page = dev_alloc_page(); @@ -579,7 +579,7 @@ struct xdp_frame *xdp_convert_zc_to_xdp_ xdpf->data = addr + metasize; xdpf->len = totsize - metasize; - xdpf->headroom = 0; + xdpf->headroom = metasize; xdpf->metasize = metasize; xdpf->frame_sz = PAGE_SIZE; xdpf->mem.type = MEM_TYPE_PAGE_ORDER0;