hotspot/src/os/bsd/vm/os_bsd.cpp
changeset 17083 14000894ef39
parent 16672 152c041083e1
child 17134 d58219af8d68
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Mon Apr 29 16:36:17 2013 -0400
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Mon Apr 29 11:03:49 2013 -0700
@@ -2080,9 +2080,10 @@
     flags |= MAP_FIXED;
   }
 
-  // Map uncommitted pages PROT_READ and PROT_WRITE, change access
-  // to PROT_EXEC if executable when we commit the page.
-  addr = (char*)::mmap(requested_addr, bytes, PROT_READ|PROT_WRITE,
+  // Map reserved/uncommitted pages PROT_NONE so we fail early if we
+  // touch an uncommitted page. Otherwise, the read/write might
+  // succeed if we have enough swap space to back the physical page.
+  addr = (char*)::mmap(requested_addr, bytes, PROT_NONE,
                        flags, -1, 0);
 
   if (addr != MAP_FAILED) {