aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Shafer <ashafer@FreeBSD.org>2025-10-28 18:08:01 +0000
committerAustin Shafer <ashafer@FreeBSD.org>2025-10-29 20:58:41 +0000
commit03b214a35db1ebdc7575cad8d695c65daf2817bf (patch)
tree8893530c09902b8017b838eaebcaead13aaa6bbb
parent75aa13c64aba71f6f26d05e8fcf96e3862d44cde (diff)
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
-rw-r--r--sys/compat/linuxkpi/common/src/linux_page.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index 628af17df853..9cc981b2ba43 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;