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 59A3B146A72 for ; Sat, 17 Aug 2024 09:12:59 +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=1723885979; cv=none; b=eaVjrKM/nj53T6b1p0V4LqRGl5lQMhJQszSIcmmqwK/kz7XCfQrPtpBBK4Qd9hobniecPP9L6OWqXH3EeP/mnVdmuH7OcdFDbyML3DmEF5APGksVw4Ta6L4HtElqZMsLq0qN3WZUj2kZjeuH46t3tE0Eanw4+4TNbbTJn4NAPM4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723885979; c=relaxed/simple; bh=Pgloc0q2A1h1vTip+6MI216I0KCN5aWSyqrZwHAq98Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qzDxn4AkkjU0ggAB9FnUTAtD4NQoyBxu5nZuCxMix06M4WtIvx70GayzS3tFoEAftKf2Veop9HHBTtF7J3nQ1rYQLqIIYXe1jQ5esrG37Tj3uz3wZZHqRQRVXROCNs4z5aEgapbi4V8vw1CvcBj/AuK1i0prO6if/bilhWwnxuE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T8V4wDel; 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="T8V4wDel" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEB92C116B1; Sat, 17 Aug 2024 09:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723885979; bh=Pgloc0q2A1h1vTip+6MI216I0KCN5aWSyqrZwHAq98Y=; h=From:To:Cc:Subject:Date:Reply-to:From; b=T8V4wDeljDaH3TDFJC9PG3n4Xq/izGkMGyoZAQjepWgFUS0LjrG99J86kwK+kfm/R NnFgGl/t+Yg1Tj8b6p9m54m6too9dME01btTHA80bHy33eN+Tu8wVRa6UjolgjIYWC RBP8ng8USF0uVq7FVulXj1CTTOs/bomr3u7pp0+8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-42316: mm/mglru: fix div-by-zero in vmpressure_calc_level() Date: Sat, 17 Aug 2024 11:10:21 +0200 Message-ID: <2024081753-CVE-2024-42316-8b49@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=2909; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Pgloc0q2A1h1vTip+6MI216I0KCN5aWSyqrZwHAq98Y=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkHMh6q3FCvW3+gRGX1ORbp0KPH51dqR1yYP/cIwxXZs B0dfu7rO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiu/gZFmz7skFsluyNC35G HBM/Plqq1pzr6ccwV/SX6KzvhbwW2dNsRD12vlIIfynzAgA= 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: mm/mglru: fix div-by-zero in vmpressure_calc_level() evict_folios() uses a second pass to reclaim folios that have gone through page writeback and become clean before it finishes the first pass, since folio_rotate_reclaimable() cannot handle those folios due to the isolation. The second pass tries to avoid potential double counting by deducting scan_control->nr_scanned. However, this can result in underflow of nr_scanned, under a condition where shrink_folio_list() does not increment nr_scanned, i.e., when folio_trylock() fails. The underflow can cause the divisor, i.e., scale=scanned+reclaimed in vmpressure_calc_level(), to become zero, resulting in the following crash: [exception RIP: vmpressure_work_fn+101] process_one_work at ffffffffa3313f2b Since scan_control->nr_scanned has no established semantics, the potential double counting has minimal risks. Therefore, fix the problem by not deducting scan_control->nr_scanned in evict_folios(). The Linux kernel CVE team has assigned CVE-2024-42316 to this issue. Affected and fixed versions =========================== Issue introduced in 6.1 with commit 359a5e1416ca and fixed in 6.1.103 with commit 8de7bf77f210 Issue introduced in 6.1 with commit 359a5e1416ca and fixed in 6.6.44 with commit d6510f234c7d Issue introduced in 6.1 with commit 359a5e1416ca and fixed in 6.10.3 with commit a39e38be632f Issue introduced in 6.1 with commit 359a5e1416ca and fixed in 6.11-rc1 with commit 8b671fe1a879 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-42316 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: mm/vmscan.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/8de7bf77f21068a5f602bb1e59adbc5ab533509d https://git.kernel.org/stable/c/d6510f234c7d117790397f9bb150816b0a954a04 https://git.kernel.org/stable/c/a39e38be632f0e1c908d70d1c9cd071c03faf895 https://git.kernel.org/stable/c/8b671fe1a879923ecfb72dda6caf01460dd885ef