From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BD88606A68E for ; Fri, 4 Dec 2026 10:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=0ZMc1AD9; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Sfmob8KV Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EA05084703; Fri, 4 Dec 2026 10:39:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id scklCGzEkqia; Fri, 4 Dec 2026 10:39:43 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 1C65784742 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796380783; b=LfPBlxlr+vrobWO75u8dwxxsLu3bxJ5EINevwwMZ0XkGxHCI45dmq7ZDGd13nxBgIPJV wImmjHe8eRlfR/xkpvjqD+8fN7MTKpAUZOX3ctbR+LF6YK0wnbu9lwPLSZOtEhZuGjLKb nFFbo6ysrZkKGbJiAirxV/WrFlLfoCOrRvnDMvoZPv531oZHDs4p5hcjshct+0yJkytyH lehrgvO+uFdmEAOMxYJfg6Iirg++3Dvs71QyrgZwWlN/Y109eCfETduGq5y2hCvgZc+l7 tR5PenXT750MTmzYzv7Ytye2aH+t9F0ZwHO6GQRsxdNXGnB10NmzVIqGlyISSjG/yNw== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796380783; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=PKFmj5ZNDapJCKJ82oIiLh5xRZr/fsNW3Ip8Xm/kAnc=; b=XfOkjUS7DaxszCSTYZvneCHIkZPU6QrA1UTrhW0jfnfjI9ykSBu5s9iTw303sG3m4PqM F4HM952rQ2nMPsRlLG5L9EhKDptQHOvAvQz2eg7nox9OtUdWMGEiWvT7t8X+wjxcqdmDV rK3G4rs8chWmWtpVz9wokyEQLllKWgZQh352JA6D5vMc4pcTYskdOsuNMdWjX/9XsESVr pQVXw1lygUbRsGHHMMNT7K6CuuR0h3VS+aopWBdyVsC7duImdG8dt/RL71T5ObZqfm3Rd 5jsQGwACx2oURVDHlNGF1GM7BWfM+KVvdJrf6phKU8X/P/er2cuP+rHmK+n2sM0JYSg== ARC-Authentication-Results: i=1; smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796380783; bh=PKFmj5ZNDapJCKJ82oIiLh5xRZr/fsNW3Ip8Xm/kAnc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=0ZMc1AD9WrhEkxGQgyz5PznsgGgmCVsqPTU2ujre58e9vzCbcU8UdB/BRFkqlx/k0 NWRV1z88IZQcMQa1nTTWx6QT1oNAwv2mnb23Bq2tlySI5VdPn9i5lAOg3sWqX99JA9 7K+kjFnVARagM2DvX7Wu538cObXlkHRErifwAiTulrC5YBUPJKTMXEcu5SRRNSzMkA XK6Jnhr3X+OzFliRK98JUAHTCuK6CVQfX6vwKubOZYAIDm6lIGWsSGeZqDe55MHFZG vo0tcDoYGRXGHGGMLhOU0WKpGmVoo1f+PVbD/YEDUFvg3+nWt8+QAV6f6Dj7Lydvup X9XRTqX5mMwbQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 1C65784742; Fri, 4 Dec 2026 10:39:43 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id C8A462A8 for ; Fri, 4 Dec 2026 10:39:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AF5186086C for ; Fri, 4 Dec 2026 10:39:40 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ezc7g_Iye_hj for ; Fri, 4 Dec 2026 10:39:40 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org D7B1F60E42 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=172.234.252.31 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=netdev-bot+sashiko@kernel.org; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Sfmob8KV Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by smtp3.osuosl.org (Postfix) with ESMTPS id D7B1F60E42 for ; Fri, 4 Dec 2026 10:39:39 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 04F9543EC4; Fri, 4 Dec 2026 10:39:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DE671F00897; Fri, 4 Dec 2026 10:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796380778; bh=PKFmj5ZNDapJCKJ82oIiLh5xRZr/fsNW3Ip8Xm/kAnc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Sfmob8KVwyNdB6QmeYDV7dLkBJV3E3pxh2YnUpPnbQv6RQkcHKXgqte4bnmJLFGAW iCw0mdA+qPPmg9m2YIz4YLuZnd533yUj2dIE1KZw/YNO3UkVKFs0Hg2C7iP3Up1l/X laltjos+p6Fl64SBQZNDb9SpzC4ULagBEGrY2v4fSZLRBiAihGWrJlx6H+8KWhWxm4 dalnqUiVLvmFiWeaa1DxKHOIS0QAhmS7HLPEdZ94NhjdHtI2OCs39aaHRmZEU6Q9OV Tq71fBnM23ITlu/tnORx2HmCssVmB+MqP1rA0Z9mY+3UVnWB0dL4U/tbO8Y0MM/CMU 5l5Ux4NxIdv6A== Subject: Re: [PATCH net v3 2/4] xdp: Size zero-copy skbs from the data, not the frame size From: netdev-bot+sashiko@kernel.org To: bjorn@kernel.org Cc: magnus.karlsson@intel.com, maciej.fijalkowski@intel.com, aleksander.lobakin@intel.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, andrew+netdev@lunn.ch, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, netdev@vger.kernel.org, bpf@vger.kernel.org, horms@kernel.org, sdf@fomichev.me, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, intel-wired-lan@lists.osuosl.org, clecigne@google.com, michal.swiatkowski@linux.intel.com, sriram.yagnaraman@ericsson.com, kurt@linutronix.de Date: Fri, 04 Dec 2026 10:39:36 +0000 Message-ID: <179638077683.3146.7227826095174306078@kernel.org> In-Reply-To: <20261203095647.3448925-3-bjorn@kernel.org> References: <20261203095647.3448925-3-bjorn@kernel.org> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Archived-By: MIME-Version: 1.0 X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message understates how much of the shared info the old xdp_build_skb_from_zc() let a sender overwrite. -- xdp: Size zero-copy skbs from the data, not the frame size This patch changes how xdp_build_skb_from_zc() sizes the skb head. It now uses data_end - data_hard_start instead of the XSk frame size, so packet data can no longer overwrite the skb_shared_info. It also copies the exact head and fragment lengths instead of rounding them up with LARGEST_ALIGN(). Heads larger than a page now come from __netdev_alloc_skb(). Link: https://lore.kernel.org/bpf/20260629072300.1664622-1-clecigne@google.com/ > With 2K chunks, no UMEM > headroom and the default MTU, a 1514 byte frame that XDP passes on > ice, idpf or gve needs 256 + 1514 + 320 = 2090 bytes and gets 2048. > The sender controls up to 48 bytes of the shared info, its frag list > among them. [Severity: Low] Is "up to 48 bytes" the real upper bound, or only the overflow for this example? The 48 bytes come from 1514 rounded up to 1520 by LARGEST_ALIGN(): 256 + 1520 + 320 - 2048 = 48. For single-buffer pools, xsk_pool_get_rx_frame_size() subtracts the shared info tailroom only for multi-buffer pools: include/net/xdp_sock_drv.h:xsk_pool_get_rx_frame_size() { ... mbuf = pool->dev && (umem->flags & XDP_UMEM_SG_FLAG); frame_size -= xsk_pool_get_tailroom(mbuf); return ALIGN_DOWN(frame_size, 128); } xp_create_and_assign_umem() sets frame_sz to the whole chunk: xskb->xdp.frame_sz = umem->chunk_size - umem->headroom; The commit message says a device may fill a single-buffer frame to its end. In that case data_end - data_hard_start can equal frame_sz. One example is a 2K chunk whose 1792 byte rx buffer is filled after a raised MTU. Another is 4K chunks with 3840 byte frames. The old code built the head with napi_build_skb(data, xdp->frame_sz). That left only frame_sz - 320 bytes of linear room. So the copy would overwrite all of SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), which is 320 bytes on x86_64, including frags[]. With 4K chunks, the LARGEST_ALIGN() rounding could also write past the page handed out by the system page pool. The sender also controls more than the frag list in the first 48 bytes. The flags, nr_frags, frag_list, dataref and destructor_arg fields all sit there. A chosen SKBFL_ZEROCOPY_* flag combined with a chosen destructor_arg gives a callback pointer. Could the commit message give the worst case as the whole shared info rather than 48 bytes? The code change closes the whole overflow. Only the stated impact looks understated. -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203095647.3448925-1-bjorn%40kernel.org