1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Correct a long-standing error in vm_object_deallocate(). Specifically,

only anonymous default (OBJT_DEFAULT) and swap (OBJT_SWAP) objects should
ever have OBJ_ONEMAPPING set.  However, vm_object_deallocate() was
setting it on device (OBJT_DEVICE) objects.  As a result,
vm_object_page_remove() could be called on a device object and if that
occurred pmap_remove_all() would be called on the device object's pages.
However, a device object's pages are fictitious, and fictitious pages do
not have an initialized pv list (struct md_page).

To date, fictitious pages have been allocated from zeroed memory,
effectively hiding this problem.  Now, however, the conversion of rotting
diagnostics to invariants in the amd64 and i386 pmaps has revealed the
problem.  Specifically, assertion failures have occurred during the
initialization phase of the X server on some hardware.

MFC after: 1 week
Discussed with: Kostik Belousov
Reported by: Michiel Boland
This commit is contained in:
Alan Cox 2008-02-24 18:03:56 +00:00
parent 47203048ab
commit 4c8e0452e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176526

View File

@ -500,7 +500,10 @@ vm_object_deallocate(vm_object_t object)
VM_OBJECT_UNLOCK(object);
return;
} else if (object->ref_count == 1) {
if (object->shadow_count == 0) {
if (object->shadow_count == 0 &&
object->handle == NULL &&
(object->type == OBJT_DEFAULT ||
object->type == OBJT_SWAP)) {
vm_object_set_flag(object, OBJ_ONEMAPPING);
} else if ((object->shadow_count == 1) &&
(object->handle == NULL) &&