Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Dec 2025 22:27:54 +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: 5f9b7cde517e - stable/14 - linuxkpi: gracefully handle page lookup failure in lkpi_vmf_insert_pfn_prot_locked
Message-ID:  <693750ea.39d98.58d6607c@gitrepo.freebsd.org>

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

The branch stable/14 has been updated by ashafer:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f9b7cde517ecd0d821b9730f37ebbdc25dbd349

commit 5f9b7cde517ecd0d821b9730f37ebbdc25dbd349
Author:     Austin Shafer <ashafer@FreeBSD.org>
AuthorDate: 2025-10-28 18:08:01 +0000
Commit:     Austin Shafer <ashafer@FreeBSD.org>
CommitDate: 2025-12-08 22:26:39 +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
    Fixed conflicts during MFC, re-reviewed by kbowling
    
    (cherry picked from commit 03b214a35db1ebdc7575cad8d695c65daf2817bf)
---
 sys/compat/linuxkpi/common/src/linux_page.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index b910ada90a4d..15b90eb3c470 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -317,6 +317,8 @@ retry:
 	page = vm_page_grab(vm_obj, pindex, VM_ALLOC_NOCREAT);
 	if (page == NULL) {
 		page = PHYS_TO_VM_PAGE(IDX_TO_OFF(pfn));
+		if (page == NULL)
+			return (VM_FAULT_SIGBUS);
 		if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL))
 			goto retry;
 		if (page->object != NULL) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?693750ea.39d98.58d6607c>