From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796257417; b=3TAe/FEnEXloU3tw3g4seGKLxQmg/klxPJTk7wfpcaVsr5eAeAxt4173lo8oo1xJz+r7 beJHGEwpGvLUK/Ahznib7aOferxMMVR0HcMaV5tRn3Rylk/U3Oq9MFKTRl8iIXntUoPb5 unqOvzQGjwYkQItCAYF8UNNJQkJx/+CgTGIBiUd07HDSwzVI9rIImq9CA4mKsOdV8IPjL xh+a0HREoJFY9VQnsLsv2VUlFHUuHusDj6SWpa1p6LzCllHHhycMr4HWtJfHFmq5D03Ho xGVeWrxl2RUXNMiaIqNo4Pp3anKDcj/d9vJo9uulLdVUaaQjLgYOe/otzdOAeooOkKw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796257417; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=M8WzQ29auOy+z9A00Rh1bQp+z5fkDbS/KRk4jXnxLwY=; b=26vJFmeAQT3c1okoQiSSJhdX1eSqwT4FHXKlC5H9PBq8jwQQe42FUQm3vvf1fl8k1T6T BmMo1PRBq+Lmn+wuQPuzilaRLaeK6jnc5uNKbewNgmLJrnu1KTmh1BUe0WL+GJ/TmKlD4 dUHfcrTBs8tLkayCZVC/b9V2WEU54sWWa455OLigLYp2H7cKkRbbd74VWYzVLa9eRPAuy nxLLPjbTvXO6B15PI7Ptje4dLWXslIbKPWgkGVXkzefOTys7J+5jkLfT9FGDZ25la/5K6 5dJqlH+XscbXPrKxRLek7IaD5U0yBfUs0+Pcs9yEw/LGmMY6gWNi6XndrbPDv9at38A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZNzUprTp; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 542C3606A32F for ; Thu, 3 Dec 2026 00:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZNzUprTp 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 Reply-To: sashiko-reviews@lists.linux.dev 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-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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