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 E3F28606A322 for ; Thu, 3 Dec 2026 00:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=P5S5epPo; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZNzUprTp Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BE4ED84CC8; Thu, 3 Dec 2026 00:23:41 +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 TQIZwziKYXeb; Thu, 3 Dec 2026 00:23:41 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org D6A5E84BAA 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=1796257420; b=TH3ooM/wsjdIfOvw+gD0hOjUBwwbR1oMnpsPvqkvBTSOtKdYLdu2yQa/+jDVT/g6K5oR 4YbazAXS/lTVkCc2Y265kOt2vyHcIzdBLJDcf+KFwwaC2MbEVzhGUx29uxPRHwiBWmr2V ey0gavikZxB0h+h/I/IzGsWAP1xzZG3GO7jxSm0lI+moLwZIccGz7xwnUlcwqP0A+FoVh PblhfLkccKYttL1x1SrD9qu8xSWFwAeTeXZmKJosztuseIP0p2mPhkeGLFohc5aEe0uwF rlT81W4XwH0Utpo5785CmTh3tdF324hFtMcMJ5LD57z51mZ59Y4+K6dfQVulOm+5nog== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796257420; 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:Message-ID:From:Subject:To:Cc:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:Date:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Reply-To:Errors-To; bh=M8WzQ29auOy+z9A00Rh1bQp+z5fkDbS/KRk4jXnxLwY=; b=DWm6WvYFLUJpK0smJOshdJowpU+nfLQSkXE1m5K2j1k1RJgs8286Qhk6YZdUZOyZp0Ur 2sUXAyBw5hb/e2rS49e+PdcFStyDk0Gz7HtbmnkXyhnNr8oSDCmP1br/q9S0N80NFB8le UMdGyrxRaLLQIdccNBRhEIrpiwTIzIYsI5zuUuHfbeR5eh1OQXyLsi++FIynyfODnvcP+ GduKej6IeOtVWM2UuaTdN7f1ZMsRlkCvdnJJeBZB8iiEIXtEiAIAeaZpgadx4zoWHb+pO WhfdizwoGt+3BI9GWJatztI1Cg+KDB4kUO0Hh129RjHskG+7NKuvJ1uSr6zZ4Y+UTJA== 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=1796257420; bh=M8WzQ29auOy+z9A00Rh1bQp+z5fkDbS/KRk4jXnxLwY=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=P5S5epPoVzLgF8isx3lOQq6LKdIwTyqVFQbB5FSl28fDHx57D5KixVm8xL7drwsoM IQ4g6BzbKRv7VEkEl+bbrcucrUwk6Ve4v8mQpApjlmAJZZzugnnRzu4k8ZywaytbBh mCpSNFc1J5SaD/OLBlt2IL7lDx+dNRrIXCXL5tmBEkParyz8TYmS/ZgJK0J27Zt5zs bNvShkRKXiKXVnlFCgelQE9L+HspUuLU7ncoESD2SDNKdo1W6P6Y+S4LcYPv6Pd3U4 A+B5193nWXcaHdBXVZp+EOTIzjqIgrg497Teg4WhaPPU9jYM3qQCCFMWlKRGTn1IZO qDJeu9Vt2ciKg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id D6A5E84BAA; Thu, 3 Dec 2026 00:23:40 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists1.osuosl.org (Postfix) with ESMTP id D56A9109 for ; Thu, 3 Dec 2026 00:23:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C37034039F for ; Thu, 3 Dec 2026 00:23:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id za52B5VWr2nS for ; Thu, 3 Dec 2026 00:23:38 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp2.osuosl.org DA26840249 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=sashiko-bot@kernel.org; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZNzUprTp Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by smtp2.osuosl.org (Postfix) with ESMTPS id DA26840249 for ; Thu, 3 Dec 2026 00:23:37 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 0024C40294; Thu, 3 Dec 2026 00:23:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB5541F00893; Thu, 3 Dec 2026 00:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796257416; bh=M8WzQ29auOy+z9A00Rh1bQp+z5fkDbS/KRk4jXnxLwY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ZNzUprTpSw2WE1kcdEKE88t9lJwIFnIOEy+DJkk3F9R9SW+8710GltbVsk0wd/PBX jaZDfN8LBFWqkVedlCqoH571sccoMf3av/peW0FlYHhN2EeuWJaDGE0Qe6nxQ4qj0o ZRhtJGHSBq/5yIRdzerxUGEest1Q54rMXJXmEx4JD65sh7S9s1NWwduHakOB1xKjqv aGiSpRvskUnKf2Dzn9z7Jyad5xp2SKsYzU6ipc/q5KRjFg6tOm1neExAlmAKuf3Psn 48G6nGZkOl/T/9Alah3bEGDFrtm7jb5/dG+KEFg1KyxDvmP1BrXEg21F/dDsp+zGFn x2XuGpM7isI+A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net v7 6/7] igb: resume the device before changing XDP or XSK settings To: "Antonio Quartulli" , intel-wired-lan@lists.osuosl.org Cc: bpf@vger.kernel.org In-Reply-To: <20261202002317.3140591-7-antonio@mandelbit.com> References: <20261202002317.3140591-1-antonio@mandelbit.com> <20261202002317.3140591-7-antonio@mandelbit.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 00:23:36 +0000 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: , Reply-To: sashiko-reviews@lists.linux.dev X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] igb: vmalloc out-of-bounds write on igb_io_resume() after XDP removal -- commit 786a2141ab9cb4e4d47bb77a0f263b3f51ba368a Author: Antonio Quartulli igb: resume the device before changing XDP or XSK settings This commit runtime-resumes the device around igb_xdp() and updates igb_xdp_setup(), igb_xsk_pool_enable() and igb_xsk_pool_disable() to handle detached devices or rings without allocated resources after a failed resume. > diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethe= rnet/intel/igb/igb_main.c > index 11c136d7bea75..a6fa33cb4521a 100644 > --- a/drivers/net/ethernet/intel/igb/igb_main.c > +++ b/drivers/net/ethernet/intel/igb/igb_main.c > @@ -2896,8 +2896,17 @@ static int igb_xdp_setup(struct net_device *dev, s= truct netdev_bpf *bpf) > bool running =3D netif_running(dev); > bool need_reset; > =20 > - /* verify igb ring attributes are sufficient for XDP */ > - for (i =3D 0; i < adapter->num_rx_queues; i++) { > + /* igb_close() doesn't close a detached device (after a failed resume, > + * or during PCI error recovery): only update the software state > + */ > + if (!netif_device_present(dev)) > + running =3D false; [Severity: Medium] Can removing an XDP program while the device is detached during PCI error recovery cause a vmalloc out-of-bounds write when igb_io_resume() runs? When an AF_XDP zero-copy pool is enabled on an active XDP queue, igb_xsk_pool_enable() -> igb_realloc_rx_buffer_info(rx_ring, true) shrinks the shared union buffer from sizeof(*ring->rx_buffer_info) * ring->count to sizeof(*ring->rx_buffer_info_zc) * ring->count. On PCI error, igb_io_error_detected() detaches the device and calls igb_down(), which cleans the rings without freeing rx_buffer_info_zc. If the XDP program is then removed while detached, setting running =3D false skips closing/reopening and only clears adapter->xdp_prog and rx_ring->xdp_prog, leaving the smaller rx_buffer_info_zc allocation in place (and a later igb_xsk_pool_disable() also skips reallocating because igb_xdp_is_enabled() is now false). When igb_io_resume() calls igb_up() -> igb_configure() -> igb_configure_rx() -> igb_configure_rx_ring(), igb_xsk_pool() returns NULL because adapter->xdp_prog is NULL: drivers/net/ethernet/intel/igb/igb_main.c:igb_configure_rx_ring() { ... WRITE_ONCE(ring->xsk_pool, igb_xsk_pool(adapter, ring)); ... /* Clear descriptor ring */ if (ring->xsk_pool) memset(ring->rx_buffer_info_zc, 0, sizeof(*ring->rx_buffer_info_zc) * ring->count); else memset(ring->rx_buffer_info, 0, sizeof(*ring->rx_buffer_info) * ring->count); ... } memset() and igb_alloc_rx_buffers() then write sizeof(struct igb_rx_buffer) * ring->count bytes into the smaller sizeof(struct xdp_buff *) * ring->count buffer. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202002317.3140= 591-1-antonio@mandelbit.com?part=3D6