svn commit: r335969 - in head/sys: amd64/amd64 i386/i386

Konstantin Belousov kib at FreeBSD.org
Wed Jul 4 21:22:01 UTC 2018


Author: kib
Date: Wed Jul  4 21:21:59 2018
New Revision: 335969
URL: https://svnweb.freebsd.org/changeset/base/335969

Log:
  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

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Wed Jul  4 19:46:26 2018	(r335968)
+++ head/sys/amd64/amd64/pmap.c	Wed Jul  4 21:21:59 2018	(r335969)
@@ -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);
 			}
 		}
 	}

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Wed Jul  4 19:46:26 2018	(r335968)
+++ head/sys/i386/i386/pmap.c	Wed Jul  4 21:21:59 2018	(r335969)
@@ -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);
 			}
 		}
 	}


More information about the svn-src-head mailing list