From mboxrd@z Thu Jan 1 00:00:00 1970 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 283802571DE for ; Fri, 2 May 2025 16:00:45 +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=1746201645; cv=none; b=tKoni12i1dComjIa6t0hcgIsROgF3sHr+ATOcn9rlxrdznueYgLMXisEik/KqoQWREQPbdKUEMccqF0+TtwiU7xNL9VK/QZiL2e5t78TP+u/XrPMik7faFNxGAYJWfjITeSagK0lYWJITwpJnDWxmmT/ke31W2VP8/wMs/LqRis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746201645; c=relaxed/simple; bh=jENOO1AX1QZo9cvOfrR3g9EkJ4G2daSBfrrm9fJLtTc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=A185Jb5PanlYEylAlnHLrcSxErAq2pgG1p0fYiZu5DinZgoRsj0rXitJN+ZohPwGs0qJtszDEnrV4Pr724GXb1adSbNI6K9pEzG+Oo9+B80ZCHQl6ppsQjqWSrznfW3Si1OVoIQHytTOYKg8zKd7Z0eLSi3aLX8Ly6FopZcYDnY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yntEses9; 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="yntEses9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE5F5C4CEE4; Fri, 2 May 2025 16:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746201645; bh=jENOO1AX1QZo9cvOfrR3g9EkJ4G2daSBfrrm9fJLtTc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=yntEses9v2ta20943wULmv3srHD2xKzWix+mVmQ95iLyDs/+xevRs6qrp52Ucz6D7 4lmjGWWY3CXrsQQHKE5q7eFo4U3L40Aa6se68PQnmmq9c4E9UUgNucKuBady9+lJSy BFeHNp2btuf9UM07HjRt1nTz/SzLBVW3aI4UE5BU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53123: PCI: s390: Fix use-after-free of PCI resources with per-function hotplug Date: Fri, 2 May 2025 17:56:28 +0200 Message-ID: <2025050232-CVE-2023-53123-73ac@gregkh> X-Mailer: git-send-email 2.49.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=4080; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=2kIqIEFdIds1m91qMjUqS0eDuf3par4T6DQOf5eYZL4=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkir74UKN/yvm+zuvvMMoY5jSz3/h4sbRX+6DhVLP18S ML+vFD+jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIYjXDgqPlR0Ucjj48vifz iynfpIMH7XavXsuw4GqFrHPPZ6FFOzPev6/a86Eh//f0JAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: PCI: s390: Fix use-after-free of PCI resources with per-function hotplug On s390 PCI functions may be hotplugged individually even when they belong to a multi-function device. In particular on an SR-IOV device VFs may be removed and later re-added. In commit a50297cf8235 ("s390/pci: separate zbus creation from scanning") it was missed however that struct pci_bus and struct zpci_bus's resource list retained a reference to the PCI functions MMIO resources even though those resources are released and freed on hot-unplug. These stale resources may subsequently be claimed when the PCI function re-appears resulting in use-after-free. One idea of fixing this use-after-free in s390 specific code that was investigated was to simply keep resources around from the moment a PCI function first appeared until the whole virtual PCI bus created for a multi-function device disappears. The problem with this however is that due to the requirement of artificial MMIO addreesses (address cookies) extra logic is then needed to keep the address cookies compatible on re-plug. At the same time the MMIO resources semantically belong to the PCI function so tying their lifecycle to the function seems more logical. Instead a simpler approach is to remove the resources of an individually hot-unplugged PCI function from the PCI bus's resource list while keeping the resources of other PCI functions on the PCI bus untouched. This is done by introducing pci_bus_remove_resource() to remove an individual resource. Similarly the resource also needs to be removed from the struct zpci_bus's resource list. It turns out however, that there is really no need to add the MMIO resources to the struct zpci_bus's resource list at all and instead we can simply use the zpci_bar_struct's resource pointer directly. The Linux kernel CVE team has assigned CVE-2023-53123 to this issue. Affected and fixed versions =========================== Issue introduced in 5.13 with commit a50297cf8235b062bcdeaa8b1dad58e69d3e1b43 and fixed in 5.15.104 with commit 437bb839e36cc9f35adc6d2a2bf113b7a0fc9985 Issue introduced in 5.13 with commit a50297cf8235b062bcdeaa8b1dad58e69d3e1b43 and fixed in 6.1.21 with commit a2410d0c3d2d714ed968a135dfcbed6aa3ff7027 Issue introduced in 5.13 with commit a50297cf8235b062bcdeaa8b1dad58e69d3e1b43 and fixed in 6.2.8 with commit b99ebf4b62774e690e73a551cf5fbf6f219bdd96 Issue introduced in 5.13 with commit a50297cf8235b062bcdeaa8b1dad58e69d3e1b43 and fixed in 6.3 with commit ab909509850b27fd39b8ba99e44cda39dbc3858c 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-2023-53123 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: arch/s390/pci/pci.c arch/s390/pci/pci_bus.c arch/s390/pci/pci_bus.h drivers/pci/bus.c include/linux/pci.h 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/437bb839e36cc9f35adc6d2a2bf113b7a0fc9985 https://git.kernel.org/stable/c/a2410d0c3d2d714ed968a135dfcbed6aa3ff7027 https://git.kernel.org/stable/c/b99ebf4b62774e690e73a551cf5fbf6f219bdd96 https://git.kernel.org/stable/c/ab909509850b27fd39b8ba99e44cda39dbc3858c