[Openmcl-cvs-notifications] r14149 - /trunk/source/lisp-kernel/memory.c

gb at clozure.com gb at clozure.com
Thu Aug 5 12:22:25 CDT 2010


Author: gb
Date: Thu Aug  5 12:22:25 2010
New Revision: 14149

Log:
If write-protecting a memory region fails with ENOMEM, map the
region readonly.

Modified:
    trunk/source/lisp-kernel/memory.c

Modified: trunk/source/lisp-kernel/memory.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/memory.c (original)
+++ trunk/source/lisp-kernel/memory.c Thu Aug  5 12:22:25 2010
@@ -349,6 +349,13 @@
   =

   if (status) {
     status =3D errno;
+    =

+    if (status =3D=3D ENOMEM) {
+      void *mapaddr =3D mmap(addr,nbytes, PROT_READ | PROT_EXEC, MAP_ANON|=
MAP_PRIVATE|MAP_FIXED,-1,0);
+      if (mapaddr !=3D MAP_FAILED) {
+        return 0;
+      }
+    }
     Bug(NULL, "couldn't protect " DECIMAL " bytes at " LISP ", errno =3D %=
d", nbytes, addr, status);
   }
   return status;



More information about the Openmcl-cvs-notifications mailing list