summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrakash Sangappa <Prakash.Sangappa@Sun.COM>2009-04-23 16:49:25 -0700
committerPrakash Sangappa <Prakash.Sangappa@Sun.COM>2009-04-23 16:49:25 -0700
commite803c1e6853ea3d193b5694f1658bc652ab69a3b (patch)
tree5dc82965c4a6315848bdcc98c2c39ef1e0c73b12
parentdcda19f50b2b80bfc622fff718ac04fb0e1cb670 (diff)
downloadillumos-gate-e803c1e6853ea3d193b5694f1658bc652ab69a3b.tar.gz
6758006 x86 hat_devload() routine should have a check to not allow mapping a free page.
-rw-r--r--usr/src/uts/i86pc/vm/hat_i86.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/src/uts/i86pc/vm/hat_i86.c b/usr/src/uts/i86pc/vm/hat_i86.c
index 8b1c1babac..718cff6ebe 100644
--- a/usr/src/uts/i86pc/vm/hat_i86.c
+++ b/usr/src/uts/i86pc/vm/hat_i86.c
@@ -1816,6 +1816,25 @@ hat_devload(
pp = page_numtopp_nolock(pfn);
/*
+ * Check to make sure we are really trying to map a valid
+ * memory page. The caller wishing to intentionally map
+ * free memory pages will have passed the HAT_LOAD_NOCONSIST
+ * flag, then pp will be NULL.
+ */
+ if (pp != NULL) {
+ if (PP_ISFREE(pp)) {
+ panic("hat_devload: loading "
+ "a mapping to free page %p", (void *)pp);
+ }
+
+ if (!PAGE_LOCKED(pp) && !PP_ISNORELOC(pp)) {
+ panic("hat_devload: loading a mapping "
+ "to an unlocked page %p",
+ (void *)pp);
+ }
+ }
+
+ /*
* load this page mapping
*/
ASSERT(!IN_VA_HOLE(va));