From d6030cdfc49e9aa10819a5438a5ae313a4538f42 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 4 Mar 2024 02:03:17 +0100 Subject: vm_allocate_contiguous: Add missing page unwiring after making the area non-pageable Otherwise, if the allocated memory is passed over for returning data such as in device_read, we end up with ../vm/vm_map.c:4245: vm_map_copyin_page_list: Assertion `src_entry->wired_count > 0' failed.Debugger invoked: assertion failure --- vm/vm_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vm/vm_user.c b/vm/vm_user.c index 868230a3..62aedad3 100644 --- a/vm/vm_user.c +++ b/vm/vm_user.c @@ -692,6 +692,9 @@ kern_return_t vm_allocate_contiguous( return kr; } + for (i = 0; i < vm_page_atop(size); i++) + vm_page_unwire(&pages[i]); + *result_vaddr = vaddr; *result_paddr = pages->phys_addr; -- cgit v1.2.3