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 8B0523101B8 for ; Mon, 15 Sep 2025 14:10:05 +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=1757945405; cv=none; b=txyXXIQaDw7oOxteyDGiNGWBINWuyF9n3sSPfjE97yIstR5b9Ts3HImoEatz9g08k++rm/rIL1Ha1eoL6IUof9Nbcl0rAFepgCJMMkabXZAUDw/IICXLkzwvX+oi/WlAux8bcK8XUfrbLhh0hFbig0YLhTlXslJorvyt4pVtIdU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757945405; c=relaxed/simple; bh=yhGxrhDwUch/PDh+AmgczqIjPay/hWlOG0aX+wUK42Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JXLfmi37reRSadCQUAM73QDEMc5rAKqyaRSB3kuGXuSEiKrDx9BrQ8oBi27XGOXnaXQCcXqWxg/2LVfGD524kcrr2vZ/PBxoJsNBQrLq4MshuDqXANQhQjeWxx/s3hrsfnHGHS885AXUXxZMJbj8mn3IvZjF+V7EJpmM29ydnZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1b7slIUL; 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="1b7slIUL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAF1BC4CEF1; Mon, 15 Sep 2025 14:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757945405; bh=yhGxrhDwUch/PDh+AmgczqIjPay/hWlOG0aX+wUK42Q=; h=From:To:Cc:Subject:Date:Reply-to:From; b=1b7slIUL9drNBlrjG6gqX8uYABIq2AqaMDdDcm7kPOGSwIPM8mdDPjezSNEZJfE+5 Eu03VQDmSmvQSK2BAY01auJ+AgegXgnNKRjThtW/gL47ruf7xtEGHJuM8Zo2TH4BYS ra4dEHudGzA+w8C1PsUDYMsM7vauPjRGan0Wdn4U= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53171: vfio/type1: prevent underflow of locked_vm via exec() Date: Mon, 15 Sep 2025 16:02:25 +0200 Message-ID: <2025091554-CVE-2023-53171-be9f@gregkh> X-Mailer: git-send-email 2.51.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=3070; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=xFYPFkhF1kc6MNY/275MIdtmteUG04muLS6vUUhNzmg=; b=owGbwMvMwCRo6H6F97bub03G02pJDBknZILKnpvsVinf6CLg7ZgnuaKhf2WF7ztXttPvimV9d 8foSlV3xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwET+yjPMldX+ebo3fe9T7uOe r4yOszieErv+mWGe6VzN/TOmJD57/vPtP+P4qY/bJu+WBgA= 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: vfio/type1: prevent underflow of locked_vm via exec() When a vfio container is preserved across exec, the task does not change, but it gets a new mm with locked_vm=0, and loses the count from existing dma mappings. If the user later unmaps a dma mapping, locked_vm underflows to a large unsigned value, and a subsequent dma map request fails with ENOMEM in __account_locked_vm. To avoid underflow, grab and save the mm at the time a dma is mapped. Use that mm when adjusting locked_vm, rather than re-acquiring the saved task's mm, which may have changed. If the saved mm is dead, do nothing. locked_vm is incremented for existing mappings in a subsequent patch. The Linux kernel CVE team has assigned CVE-2023-53171 to this issue. Affected and fixed versions =========================== Issue introduced in 3.6 with commit 73fa0d10d077d9521ee2dace2307ae2c9a965336 and fixed in 5.10.173 with commit 5a271242716846cc016736fb76be2b40ee49b0c3 Issue introduced in 3.6 with commit 73fa0d10d077d9521ee2dace2307ae2c9a965336 and fixed in 5.15.99 with commit eafb81c50da899dd80b340c841277acc4a1945b7 Issue introduced in 3.6 with commit 73fa0d10d077d9521ee2dace2307ae2c9a965336 and fixed in 6.1.16 with commit a6b2aabe664098d5cf877ae0fd96459464a30e17 Issue introduced in 3.6 with commit 73fa0d10d077d9521ee2dace2307ae2c9a965336 and fixed in 6.2.3 with commit b0790dff0760b7734cf0961f497ad64628ca550b Issue introduced in 3.6 with commit 73fa0d10d077d9521ee2dace2307ae2c9a965336 and fixed in 6.3 with commit 046eca5018f8a5dd1dc2cedf87fb5843b9ea3026 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-53171 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/vfio/vfio_iommu_type1.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/5a271242716846cc016736fb76be2b40ee49b0c3 https://git.kernel.org/stable/c/eafb81c50da899dd80b340c841277acc4a1945b7 https://git.kernel.org/stable/c/a6b2aabe664098d5cf877ae0fd96459464a30e17 https://git.kernel.org/stable/c/b0790dff0760b7734cf0961f497ad64628ca550b https://git.kernel.org/stable/c/046eca5018f8a5dd1dc2cedf87fb5843b9ea3026