In x86 pmap_extract_and_hold()s, handle the case of PHYS_TO_VM_PAGE()

returning NULL.

vm_fault_quick_hold_pages() can be legitimately called on userspace
mappings backed by fictitious pages created by unmanaged device and sg
pagers.

Note that other architectures pmap_extract_and_hold() might need
similar fix, but I postponed the examination.

Reported by:	bde
Discussed with:	alc
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D16085
This commit is contained in:
Konstantin Belousov 2018-07-04 21:21:59 +00:00
parent ff3b992f38
commit 84a15fe70d
2 changed files with 4 additions and 2 deletions

View File

@ -2319,7 +2319,8 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
vm_page_hold(m);
if (m != NULL)
vm_page_hold(m);
}
}
}

View File

@ -1684,7 +1684,8 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
vm_page_hold(m);
if (m != NULL)
vm_page_hold(m);
}
}
}