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 81C6120B7EA for ; Tue, 1 Apr 2025 15:42:49 +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=1743522169; cv=none; b=Jb5JpYbZAb8FpfYG+TT2AnNc7/3NUNpdo7qCtOn8karO4lDxjtdNlsOT+gh855NI5i+uUy6HSCdH+kktgKsQJm5lum7UiEDN+lQIV5uhfiBSOD5eol06AKpuY+PLRwkoYSOIMSQmE/hro/OUjlUNP/vyN9rb3EitE5jMH2nhUY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743522169; c=relaxed/simple; bh=2+ShJPJpO+3ITRAhL8ql0fz4bTwzoDbRzIp8aX1eVv8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ogD1RUQLwUKXAGP4ciAI+KpJxxlVBpSLqsR2xGVl4tTzGBoC3PPylU94L9dJ5cKGsPi7Zpiolcuabrr8hEl/sx78qglQKR2tRAaIIHAo67s+WpJL89wUknPhGoy1kkJw5Q4pPgWQaY9ia8/zOrobCT5W0tNgTr6QpkQNMdZmxKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LupCiEG2; 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="LupCiEG2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0BDC4CEE8; Tue, 1 Apr 2025 15:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1743522169; bh=2+ShJPJpO+3ITRAhL8ql0fz4bTwzoDbRzIp8aX1eVv8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=LupCiEG2Ca6kVASvwOnONCCI9LFeULTnxMuUxIpp1b+bXO0PMFN9UOiMuwvLliEle 6CwYSmDPxznekshfokAre0Zkr5+kYd70I5HZxjDWLPTYakFKVpM1+DirCXX4eG9Lsq Dgi2saKJlUK8FtDsTfQ+hpFDuRSnA1KgtDbYLdWQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21949: LoongArch: Set hugetlb mmap base address aligned with pmd size Date: Tue, 1 Apr 2025 16:40:13 +0100 Message-ID: <2025040136-CVE-2025-21949-e05a@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=3859; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=2+ShJPJpO+3ITRAhL8ql0fz4bTwzoDbRzIp8aX1eVv8=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlvOHasqjjiU5X1ZPmxP9qzd3J9EqvUeLrc6/05XfHX5 w+werGmd8SyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEyhYxLGi8cFZlnaCHpXOn zpU7DuyqSdLTdjAsaLEpktl/Kas1X6f3fNvt5DsHr1z7BgA= 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: LoongArch: Set hugetlb mmap base address aligned with pmd size With ltp test case "testcases/bin/hugefork02", there is a dmesg error report message such as: kernel BUG at mm/hugetlb.c:5550! Oops - BUG[#1]: CPU: 0 UID: 0 PID: 1517 Comm: hugefork02 Not tainted 6.14.0-rc2+ #241 Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022 pc 90000000004eaf1c ra 9000000000485538 tp 900000010edbc000 sp 900000010edbf940 a0 900000010edbfb00 a1 9000000108d20280 a2 00007fffe9474000 a3 00007ffff3474000 a4 0000000000000000 a5 0000000000000003 a6 00000000003cadd3 a7 0000000000000000 t0 0000000001ffffff t1 0000000001474000 t2 900000010ecd7900 t3 00007fffe9474000 t4 00007fffe9474000 t5 0000000000000040 t6 900000010edbfb00 t7 0000000000000001 t8 0000000000000005 u0 90000000004849d0 s9 900000010edbfa00 s0 9000000108d20280 s1 00007fffe9474000 s2 0000000002000000 s3 9000000108d20280 s4 9000000002b38b10 s5 900000010edbfb00 s6 00007ffff3474000 s7 0000000000000406 s8 900000010edbfa08 ra: 9000000000485538 unmap_vmas+0x130/0x218 ERA: 90000000004eaf1c __unmap_hugepage_range+0x6f4/0x7d0 PRMD: 00000004 (PPLV0 +PIE -PWE) EUEN: 00000007 (+FPE +SXE +ASXE -BTE) ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7) ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0) PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) Process hugefork02 (pid: 1517, threadinfo=00000000a670eaf4, task=000000007a95fc64) Call Trace: [<90000000004eaf1c>] __unmap_hugepage_range+0x6f4/0x7d0 [<9000000000485534>] unmap_vmas+0x12c/0x218 [<9000000000494068>] exit_mmap+0xe0/0x308 [<900000000025fdc4>] mmput+0x74/0x180 [<900000000026a284>] do_exit+0x294/0x898 [<900000000026aa30>] do_group_exit+0x30/0x98 [<900000000027bed4>] get_signal+0x83c/0x868 [<90000000002457b4>] arch_do_signal_or_restart+0x54/0xfa0 [<90000000015795e8>] irqentry_exit_to_user_mode+0xb8/0x138 [<90000000002572d0>] tlb_do_page_fault_1+0x114/0x1b4 The problem is that base address allocated from hugetlbfs is not aligned with pmd size. Here add a checking for hugetlbfs and align base address with pmd size. After this patch the test case "testcases/bin/hugefork02" passes to run. This is similar to the commit 7f24cbc9c4d42db8a3c8484d1 ("mm/mmap: teach generic_get_unmapped_area{_topdown} to handle hugetlb mappings"). The Linux kernel CVE team has assigned CVE-2025-21949 to this issue. Affected and fixed versions =========================== Fixed in 6.13.7 with commit 242b34f48a377afe4b285b472bd0f17744fca8e8 Fixed in 6.14 with commit 3109d5ff484b7bc7b955f166974c6776d91f247b 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-2025-21949 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/loongarch/mm/mmap.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/242b34f48a377afe4b285b472bd0f17744fca8e8 https://git.kernel.org/stable/c/3109d5ff484b7bc7b955f166974c6776d91f247b