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 70A651DB365 for ; Wed, 26 Feb 2025 01:59:34 +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=1740535174; cv=none; b=WBQgVDzxbCa/RsGn5/W/BUln6pBMdA9Np5y5bRRrVk7b+ghrKIECq6JxBfENTPjO/KFQUKKuH7FYZfGC7kRcCHrTcWa4vYywt7ejpFQ80iFzZL5nvihvZs8zv+T7ZPs+qQ7ie8a8k8Be4proG5xreOg21y3C5rKY4DUOplaBTJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535174; c=relaxed/simple; bh=cz2zXp+XREqtnroIZqSnYz1+mCvJCbzFHPVL84DVtKw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ce54CJ6/HlHftRad/6/Wd/igiLa1RpwmBXxE6injkR3umUGGNOBVBMm7pmBUorOFLppMQ7vkUtpHdDezV3q3xjl8Y/LUuC4fjZYBxYPtDPgLmP8YZ9zJjwlngmqwdy4tfKL3yjmswPquC5W3V9Rs3IzwB5mjesbBCTcK3VpVw4I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TxUuVmtz; 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="TxUuVmtz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F8BC4CEE6; Wed, 26 Feb 2025 01:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535174; bh=cz2zXp+XREqtnroIZqSnYz1+mCvJCbzFHPVL84DVtKw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=TxUuVmtzaAoH2VprXcIPEQwW/kxFVhBIDn30RtW+F+n3fa7DadVa6KoViL/pE3cEj jo2tBJJtLjM94H4aAstQlNkuRx0GwEIvZaSSFh7VkkChikPIG1+GQnHpDQH8uQxn8h mFBPTTDFZTRXHfG3qO/K4pP1gePbxVhQeNMetuE8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49214: powerpc/64s: Don't use DSISR for SLB faults Date: Wed, 26 Feb 2025 02:56:59 +0100 Message-ID: <2025022620-CVE-2022-49214-1b9a@gregkh> X-Mailer: git-send-email 2.48.1 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=4373; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=cz2zXp+XREqtnroIZqSnYz1+mCvJCbzFHPVL84DVtKw=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7Snw8bF7XaZ73Z1XedlB48hbOuvzKy2ZLP1iZZv12+ K606otjRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzk/yWGBTurFeNOLPBRULqw svBa9SH9NK89NQzzbPI2Ltvm0p11WLz/U99Ova1bf01WAAA= 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: powerpc/64s: Don't use DSISR for SLB faults Since commit 46ddcb3950a2 ("powerpc/mm: Show if a bad page fault on data is read or write.") we use page_fault_is_write(regs->dsisr) in __bad_page_fault() to determine if the fault is for a read or write, and change the message printed accordingly. But SLB faults, aka Data Segment Interrupts, don't set DSISR (Data Storage Interrupt Status Register) to a useful value. All ISA versions from v2.03 through v3.1 specify that the Data Segment Interrupt sets DSISR "to an undefined value". As far as I can see there's no mention of SLB faults setting DSISR in any BookIV content either. This manifests as accesses that should be a read being incorrectly reported as writes, for example, using the xmon "dump" command: 0:mon> d 0x5deadbeef0000000 5deadbeef0000000 [359526.415354][ C6] BUG: Unable to handle kernel data access on write at 0x5deadbeef0000000 [359526.415611][ C6] Faulting instruction address: 0xc00000000010a300 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf400] pc: c00000000010a300: mread+0x90/0x190 If we disassemble the PC, we see a load instruction: 0:mon> di c00000000010a300 c00000000010a300 89490000 lbz r10,0(r9) We can also see in exceptions-64s.S that the data_access_slb block doesn't set IDSISR=1, which means it doesn't load DSISR into pt_regs. So the value we're using to determine if the fault is a read/write is some stale value in pt_regs from a previous page fault. Rework the printing logic to separate the SLB fault case out, and only print read/write in the cases where we can determine it. The result looks like eg: 0:mon> d 0x5deadbeef0000000 5deadbeef0000000 [ 721.779525][ C6] BUG: Unable to handle kernel data access at 0x5deadbeef0000000 [ 721.779697][ C6] Faulting instruction address: 0xc00000000014cbe0 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf390] 0:mon> d 0 0000000000000000 [ 742.793242][ C6] BUG: Kernel NULL pointer dereference at 0x00000000 [ 742.793316][ C6] Faulting instruction address: 0xc00000000014cbe0 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf390] The Linux kernel CVE team has assigned CVE-2022-49214 to this issue. Affected and fixed versions =========================== Issue introduced in 5.5 with commit 46ddcb3950a28c0df4815e8dbb8d4b91d5d9f22d and fixed in 5.15.33 with commit 4a852ff9b7bea9c640540e2c1bc70bd3ba455d61 Issue introduced in 5.5 with commit 46ddcb3950a28c0df4815e8dbb8d4b91d5d9f22d and fixed in 5.16.19 with commit a3dae36d632b2cf6eb20314273e512a96cb43c9a Issue introduced in 5.5 with commit 46ddcb3950a28c0df4815e8dbb8d4b91d5d9f22d and fixed in 5.17.2 with commit 093449bb182db885dae816d62874cccab7a4c42a Issue introduced in 5.5 with commit 46ddcb3950a28c0df4815e8dbb8d4b91d5d9f22d and fixed in 5.18 with commit d4679ac8ea2e5078704aa1c026db36580cc1bf9a 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-2022-49214 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/powerpc/mm/fault.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/4a852ff9b7bea9c640540e2c1bc70bd3ba455d61 https://git.kernel.org/stable/c/a3dae36d632b2cf6eb20314273e512a96cb43c9a https://git.kernel.org/stable/c/093449bb182db885dae816d62874cccab7a4c42a https://git.kernel.org/stable/c/d4679ac8ea2e5078704aa1c026db36580cc1bf9a