Changeset 14149


Ignore:
Timestamp:
Aug 5, 2010, 5:22:25 PM (9 years ago)
Author:
gb
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/memory.c

    r13431 r14149  
    350350  if (status) {
    351351    status = errno;
     352   
     353    if (status == ENOMEM) {
     354      void *mapaddr = mmap(addr,nbytes, PROT_READ | PROT_EXEC, MAP_ANON|MAP_PRIVATE|MAP_FIXED,-1,0);
     355      if (mapaddr != MAP_FAILED) {
     356        return 0;
     357      }
     358    }
    352359    Bug(NULL, "couldn't protect " DECIMAL " bytes at " LISP ", errno = %d", nbytes, addr, status);
    353360  }
Note: See TracChangeset for help on using the changeset viewer.