Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ACC4C16FF45 for ; Wed, 18 Sep 2024 07:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726643977; cv=none; b=gAcAEcHVwFcFSujkVfkqjWVJJ6bHjcs0QNBqPySdod5/00v0a4Qtm4HOs2evoJ6v+2v5bcb6A+/j8gBKHn6LkTqexLsdLiO3MKxI0Da8/5g1N8YhZua9z+ICuyVFY9uKuOrBbNwt35SNsTrRPhkBv1P1iPsIzXoVHqBcFwfbAHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726643977; c=relaxed/simple; bh=/+mG8Wc27FG+YR5htIPC36ncq/I7FMvY+2fToeAKQiU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VbWx0haeay7urscvrXTSm2wl+cw/k5p2drFB8z3lt5IhwPve2plu1axIUi/6q6dm/6tnCg+YXAw3FlMsJAJSviL5TEbXr3d66HMHdnpBAXLHQaLw/NnYb7vWv43E9fL2RGeXXUYC2DbHq937JnpZvHgwg62hg0EddxgAbcUQmek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lvwEAWe1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lvwEAWe1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E96C8C4CEC3; Wed, 18 Sep 2024 07:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726643977; bh=/+mG8Wc27FG+YR5htIPC36ncq/I7FMvY+2fToeAKQiU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=lvwEAWe12tOtafHD9z0Emc5tWi7WlhQR1M9yci/H3ySBoKua4SvAyC0/mdWRijMN0 iBd5OZPYyopXZbSCWoTIUx2HucPTpzb4BqVM9q6QcZlqOwbD1SsV/8nm4gXa03G9LM HEY3k+K3zEuXmRKfbu/sKzCSbsN1ipffLZPJy9co= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-46766: ice: move netif_queue_set_napi to rtnl-protected sections Date: Wed, 18 Sep 2024 09:17:01 +0200 Message-ID: <2024091844-CVE-2024-46766-417c@gregkh> X-Mailer: git-send-email 2.46.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5121; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=/+mG8Wc27FG+YR5htIPC36ncq/I7FMvY+2fToeAKQiU=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmv6mJs3SfzlGV8OTJ9Q5uA/+nd1hMMg4L3SDY9NdDW7 0+8dPdPRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzk+VGGuWKcbsIJkwXbrrdd zHVg0qn8Y8r9hWF+otrljkQdkeJ3IvFBKgezp83NEr0BAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: ice: move netif_queue_set_napi to rtnl-protected sections Currently, netif_queue_set_napi() is called from ice_vsi_rebuild() that is not rtnl-locked when called from the reset. This creates the need to take the rtnl_lock just for a single function and complicates the synchronization with .ndo_bpf. At the same time, there no actual need to fill napi-to-queue information at this exact point. Fill napi-to-queue information when opening the VSI and clear it when the VSI is being closed. Those routines are already rtnl-locked. Also, rewrite napi-to-queue assignment in a way that prevents inclusion of XDP queues, as this leads to out-of-bounds writes, such as one below. [ +0.000004] BUG: KASAN: slab-out-of-bounds in netif_queue_set_napi+0x1c2/0x1e0 [ +0.000012] Write of size 8 at addr ffff889881727c80 by task bash/7047 [ +0.000006] CPU: 24 PID: 7047 Comm: bash Not tainted 6.10.0-rc2+ #2 [ +0.000004] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0014.082620210524 08/26/2021 [ +0.000003] Call Trace: [ +0.000003] [ +0.000002] dump_stack_lvl+0x60/0x80 [ +0.000007] print_report+0xce/0x630 [ +0.000007] ? __pfx__raw_spin_lock_irqsave+0x10/0x10 [ +0.000007] ? __virt_addr_valid+0x1c9/0x2c0 [ +0.000005] ? netif_queue_set_napi+0x1c2/0x1e0 [ +0.000003] kasan_report+0xe9/0x120 [ +0.000004] ? netif_queue_set_napi+0x1c2/0x1e0 [ +0.000004] netif_queue_set_napi+0x1c2/0x1e0 [ +0.000005] ice_vsi_close+0x161/0x670 [ice] [ +0.000114] ice_dis_vsi+0x22f/0x270 [ice] [ +0.000095] ice_pf_dis_all_vsi.constprop.0+0xae/0x1c0 [ice] [ +0.000086] ice_prepare_for_reset+0x299/0x750 [ice] [ +0.000087] pci_dev_save_and_disable+0x82/0xd0 [ +0.000006] pci_reset_function+0x12d/0x230 [ +0.000004] reset_store+0xa0/0x100 [ +0.000006] ? __pfx_reset_store+0x10/0x10 [ +0.000002] ? __pfx_mutex_lock+0x10/0x10 [ +0.000004] ? __check_object_size+0x4c1/0x640 [ +0.000007] kernfs_fop_write_iter+0x30b/0x4a0 [ +0.000006] vfs_write+0x5d6/0xdf0 [ +0.000005] ? fd_install+0x180/0x350 [ +0.000005] ? __pfx_vfs_write+0x10/0xA10 [ +0.000004] ? do_fcntl+0x52c/0xcd0 [ +0.000004] ? kasan_save_track+0x13/0x60 [ +0.000003] ? kasan_save_free_info+0x37/0x60 [ +0.000006] ksys_write+0xfa/0x1d0 [ +0.000003] ? __pfx_ksys_write+0x10/0x10 [ +0.000002] ? __x64_sys_fcntl+0x121/0x180 [ +0.000004] ? _raw_spin_lock+0x87/0xe0 [ +0.000005] do_syscall_64+0x80/0x170 [ +0.000007] ? _raw_spin_lock+0x87/0xe0 [ +0.000004] ? __pfx__raw_spin_lock+0x10/0x10 [ +0.000003] ? file_close_fd_locked+0x167/0x230 [ +0.000005] ? syscall_exit_to_user_mode+0x7d/0x220 [ +0.000005] ? do_syscall_64+0x8c/0x170 [ +0.000004] ? do_syscall_64+0x8c/0x170 [ +0.000003] ? do_syscall_64+0x8c/0x170 [ +0.000003] ? fput+0x1a/0x2c0 [ +0.000004] ? filp_close+0x19/0x30 [ +0.000004] ? do_dup2+0x25a/0x4c0 [ +0.000004] ? __x64_sys_dup2+0x6e/0x2e0 [ +0.000002] ? syscall_exit_to_user_mode+0x7d/0x220 [ +0.000004] ? do_syscall_64+0x8c/0x170 [ +0.000003] ? __count_memcg_events+0x113/0x380 [ +0.000005] ? handle_mm_fault+0x136/0x820 [ +0.000005] ? do_user_addr_fault+0x444/0xa80 [ +0.000004] ? clear_bhb_loop+0x25/0x80 [ +0.000004] ? clear_bhb_loop+0x25/0x80 [ +0.000002] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ +0.000005] RIP: 0033:0x7f2033593154 The Linux kernel CVE team has assigned CVE-2024-46766 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit 080b0c8d6d26 and fixed in 6.10.10 with commit 2285c2faef19 Issue introduced in 6.8 with commit 080b0c8d6d26 and fixed in 6.11 with commit 2a5dc090b92c Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-46766 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/net/ethernet/intel/ice/ice_base.c drivers/net/ethernet/intel/ice/ice_lib.c drivers/net/ethernet/intel/ice/ice_lib.h drivers/net/ethernet/intel/ice/ice_main.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/2285c2faef19ee08a6bd6754f4c3ec07dceb2889 https://git.kernel.org/stable/c/2a5dc090b92cfa5270e20056074241c6db5c9cdd