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 7BEB8148FF5 for ; Wed, 3 Apr 2024 14:57:43 +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=1712156263; cv=none; b=J9t8SNLdJmZC9YtcBgXPhimNIFQlhHxFrdfC79ZbcCkzFlCbM6QxpC8TESQhWIYErdvB9QiZTES6BRQjQysISK0d0cY0ciAxBoVEOh+wIKfD0+8ARsssvyGS5yqKj+haTqTH9iFh0a0pIywWmqlQczvhNULP2y3qFTs+9heky9k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712156263; c=relaxed/simple; bh=JL4Pe0hQW2E4GSDunxbnjzWDgaCxGFaXojwG7aB+p+Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hd6VCl+IbJdnOCC8hqZH6HEEcsZ8boy0pmcbZJIo5wsY39x3CbFYbodi0PpaU9NSV9kaFYuODEQGhj9bDNb1w58JeXgetQ2Dh7ty+LCXVv3uSH1m/PfPOnsVPTWn3x6HDExJhXXb1agaAOKg9W6kuKDMkAhiiUqr0u8SYl9NYs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=loWKI6hu; 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="loWKI6hu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE0F0C433F1; Wed, 3 Apr 2024 14:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712156263; bh=JL4Pe0hQW2E4GSDunxbnjzWDgaCxGFaXojwG7aB+p+Q=; h=From:To:Cc:Subject:Date:Reply-to:From; b=loWKI6hu02+2MzmxLfHsHI+d4qMYF2110OUcMTxEOKbtpgrFxDxAfwYYoeIJSHiio BAI6beJa1CfgR2JD1BLh7mPpRXSKinaSMacfd0IMCmuDlhlrWwY/aPywosmQCzuSPL QqY/C5MQPE3SLPmpeGG6wnCQdwXHSiSe47XJoJgU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-26712: powerpc/kasan: Fix addr error caused by page alignment Date: Wed, 3 Apr 2024 16:56:03 +0200 Message-ID: <2024040342-CVE-2024-26712-d713@gregkh> X-Mailer: git-send-email 2.44.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=3469; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=JL4Pe0hQW2E4GSDunxbnjzWDgaCxGFaXojwG7aB+p+Q=; b=owGbwMvMwCRo6H6F97bub03G02pJDGm8ue8+pBppPG8sbXlzrEpC+NHz7CssIaeNJnVtaLr3S rF8Ul1ERywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEyE7zjDgn07p+aLhNuI86t2 eiryv9jU81CdhWHBiZ3XOGpcm1fz3s08on1w5imdGW9+AAA= 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/kasan: Fix addr error caused by page alignment In kasan_init_region, when k_start is not page aligned, at the begin of for loop, k_cur = k_start & PAGE_MASK is less than k_start, and then `va = block + k_cur - k_start` is less than block, the addr va is invalid, because the memory address space from va to block is not alloced by memblock_alloc, which will not be reserved by memblock_reserve later, it will be used by other places. As a result, memory overwriting occurs. for example: int __init __weak kasan_init_region(void *start, size_t size) { [...] /* if say block(dcd97000) k_start(feef7400) k_end(feeff3fe) */ block = memblock_alloc(k_end - k_start, PAGE_SIZE); [...] for (k_cur = k_start & PAGE_MASK; k_cur < k_end; k_cur += PAGE_SIZE) { /* at the begin of for loop * block(dcd97000) va(dcd96c00) k_cur(feef7000) k_start(feef7400) * va(dcd96c00) is less than block(dcd97000), va is invalid */ void *va = block + k_cur - k_start; [...] } [...] } Therefore, page alignment is performed on k_start before memblock_alloc() to ensure the validity of the VA address. The Linux kernel CVE team has assigned CVE-2024-26712 to this issue. Affected and fixed versions =========================== Issue introduced in 5.4 with commit 663c0c9496a6 and fixed in 5.10.210 with commit 230e89b5ad0a Issue introduced in 5.4 with commit 663c0c9496a6 and fixed in 5.15.149 with commit 2738e0aa2fb2 Issue introduced in 5.4 with commit 663c0c9496a6 and fixed in 6.1.79 with commit 0c09912dd838 Issue introduced in 5.4 with commit 663c0c9496a6 and fixed in 6.6.18 with commit 0516c06b19dc Issue introduced in 5.4 with commit 663c0c9496a6 and fixed in 6.7.6 with commit 70ef2ba1f428 Issue introduced in 5.4 with commit 663c0c9496a6 and fixed in 6.8 with commit 4a7aee96200a Issue introduced in 5.3.6 with commit 5ce93076d8ee 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-26712 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/kasan/init_32.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/230e89b5ad0a33f530a2a976b3e5e4385cb27882 https://git.kernel.org/stable/c/2738e0aa2fb24a7ab9c878d912dc2b239738c6c6 https://git.kernel.org/stable/c/0c09912dd8387e228afcc5e34ac5d79b1e3a1058 https://git.kernel.org/stable/c/0516c06b19dc64807c10e01bb99b552bdf2d7dbe https://git.kernel.org/stable/c/70ef2ba1f4286b2b73675aeb424b590c92d57b25 https://git.kernel.org/stable/c/4a7aee96200ad281a5cc4cf5c7a2e2a49d2b97b0