Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Dec 2025 18:09:13 +0000
From:      Austin Shafer <ashafer@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 452b92fadae1 - stable/15 - linuxkpi: gracefully handle page lookup failure in lkpi_vmf_insert_pfn_prot_locked
Message-ID:  <69371449.cb52.3c135d9c@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help

The branch stable/15 has been updated by ashafer:

URL: https://cgit.FreeBSD.org/src/commit/?id=452b92fadae16e30f815203863bb9dd92ddff762

commit 452b92fadae16e30f815203863bb9dd92ddff762
Author:     Austin Shafer <ashafer@FreeBSD.org>
AuthorDate: 2025-10-28 18:08:01 +0000
Commit:     Austin Shafer <ashafer@FreeBSD.org>
CommitDate: 2025-12-08 18:08:32 +0000

    linuxkpi: gracefully handle page lookup failure in lkpi_vmf_insert_pfn_prot_locked
    
    Currently lkpi_vmf_insert_pfn_prot_locked will check the page iter to
    find a usage of the page. If no page was found, it continues on to
    try using PHYS_TO_VM_PAGE() to get a page. Currently it does not check
    if a valid page was found before passing it to vm_page_busy_acquire,
    which can cause a kernel page fault as vm_page_busy_acquire expects
    a valid page pointer.
    
    This can easily be triggered while starting KDE6 in wayland mode, which
    many users have been reporting. With this change plasma6 starts properly
    in wayland mode.
    
    Sponsored by:   NVIDIA
    PR:             288565
    Reviewed by:    markj, kbowling (mentor)
    Differential Revision:  https://reviews.freebsd.org/D53412
    
    (cherry picked from commit 03b214a35db1ebdc7575cad8d695c65daf2817bf)
---
 sys/compat/linuxkpi/common/src/linux_page.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index a71a708c1bd8..2b2827579cba 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -345,6 +345,10 @@ retry:
 	page = vm_page_grab_iter(vm_obj, pindex, VM_ALLOC_NOCREAT, &pages);
 	if (page == NULL) {
 		page = PHYS_TO_VM_PAGE(IDX_TO_OFF(pfn));
+		if (page == NULL) {
+			pctrie_iter_reset(&pages);
+			return (VM_FAULT_SIGBUS);
+		}
 		if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) {
 			pctrie_iter_reset(&pages);
 			goto retry;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69371449.cb52.3c135d9c>