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 217412882C3 for ; Wed, 18 Jun 2025 11:04:04 +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=1750244644; cv=none; b=RdsXJ4EwmHC3XV6CsXFhfNwzXFJc+TTrYl9RpU9RnCYsreIo8KvuvCEVoZAr8WuciOn/iMU5xtdQPJRkZxFdkw3jlEDT/rVrn8+shit8gbZHNysLGVLPblhFKwYYFpuPDdt956+JbZ5LQGkDHWLwK7XfjoLpePKSepj/LgN9Bi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244644; c=relaxed/simple; bh=ZiADxfB1OUhZtMeBGceO+mlP06bu+BxiBO/a2kRJ1Uk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iMhG8K1aAP0C8HZA2gzb9FPjCWQ3prLjlP4HL8vKlmkbkYWx+cskGgAj6Ymt17+ZTYVA7DInJ+UuzERtvFJSrz2H65FnOuLG1H9ZRZtSYvx7/cOYrphykr5pSq3A+22m/Lc3hu8LbnUAaKZGJQ2ozqKFbt5f0W02AErPFcHZuq8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IIljDHdO; 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="IIljDHdO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2B09C4CEE7; Wed, 18 Jun 2025 11:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244644; bh=ZiADxfB1OUhZtMeBGceO+mlP06bu+BxiBO/a2kRJ1Uk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=IIljDHdOnZJ2UG9Cj5d5kteX05R2IW4iw5kcqaG0JaLHepMMqV7bjpAj/J9WZIoQD oubLRaEUqZGaFGR7gxChg6dxXLCAt0xGK2E0CeNdQBRefaBRlc6mrA6h1+zG9eYa+l ilDVhshS/UmG2k7ByEdGXyNhUkt4eXULUO7jm2NA= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49992: mm/mprotect: only reference swap pfn page if type match Date: Wed, 18 Jun 2025 13:00:57 +0200 Message-ID: <2025061825-CVE-2022-49992-c5f0@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=3544; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=BAezeaUAAdQCOMCSOy0t36L+PxuuGGS2iaEbNLCtHJs=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBczyP6jTbu12XOJDXvfTEgs06pzs/f99w6+Jbzl/bJ 13Ptz+i2hHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQATOT2DYX6t4byjWxf/kLCI EL5yf6+j2mvVorsMc7h89orvCer0S9jnu9HSOM7A98TVXwA= 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: mm/mprotect: only reference swap pfn page if type match Yu Zhao reported a bug after the commit "mm/swap: Add swp_offset_pfn() to fetch PFN from swap entry" added a check in swp_offset_pfn() for swap type [1]: kernel BUG at include/linux/swapops.h:117! CPU: 46 PID: 5245 Comm: EventManager_De Tainted: G S O L 6.0.0-dbg-DEV #2 RIP: 0010:pfn_swap_entry_to_page+0x72/0xf0 Code: c6 48 8b 36 48 83 fe ff 74 53 48 01 d1 48 83 c1 08 48 8b 09 f6 c1 01 75 7b 66 90 48 89 c1 48 8b 09 f6 c1 01 74 74 5d c3 eb 9e <0f> 0b 48 ba ff ff ff ff 03 00 00 00 eb ae a9 ff 0f 00 00 75 13 48 RSP: 0018:ffffa59e73fabb80 EFLAGS: 00010282 RAX: 00000000ffffffe8 RBX: 0c00000000000000 RCX: ffffcd5440000000 RDX: 1ffffffffff7a80a RSI: 0000000000000000 RDI: 0c0000000000042b RBP: ffffa59e73fabb80 R08: ffff9965ca6e8bb8 R09: 0000000000000000 R10: ffffffffa5a2f62d R11: 0000030b372e9fff R12: ffff997b79db5738 R13: 000000000000042b R14: 0c0000000000042b R15: 1ffffffffff7a80a FS: 00007f549d1bb700(0000) GS:ffff99d3cf680000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000440d035b3180 CR3: 0000002243176004 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: change_pte_range+0x36e/0x880 change_p4d_range+0x2e8/0x670 change_protection_range+0x14e/0x2c0 mprotect_fixup+0x1ee/0x330 do_mprotect_pkey+0x34c/0x440 __x64_sys_mprotect+0x1d/0x30 It triggers because pfn_swap_entry_to_page() could be called upon e.g. a genuine swap entry. Fix it by only calling it when it's a write migration entry where the page* is used. [1] https://lore.kernel.org/lkml/CAOUHufaVC2Za-p8m0aiHw6YkheDcrO-C3wRGixwDS32VTS+k1w@mail.gmail.com/ The Linux kernel CVE team has assigned CVE-2022-49992 to this issue. Affected and fixed versions =========================== Issue introduced in 5.19 with commit 6c287605fd56466e645693eff3ae7c08fba56e0a and fixed in 5.19.6 with commit 5fcf81e308d1f4ae95f31690d2a80b7061385ff9 Issue introduced in 5.19 with commit 6c287605fd56466e645693eff3ae7c08fba56e0a and fixed in 6.0 with commit 3d2f78f08cd8388035ac375e731ec1ac1b79b09d 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-49992 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/mprotect.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/5fcf81e308d1f4ae95f31690d2a80b7061385ff9 https://git.kernel.org/stable/c/3d2f78f08cd8388035ac375e731ec1ac1b79b09d