Hi Ken,

On Jan 18 15:58, Ken Brown wrote:
> Hi Corinna,
> 
> I'm puzzled by the code at mmap.cc:1294 starting with if (!in_mapped). If we
> get there and in_mapped is false, then the pages in the mprotect call don't
> meet any mmap_record.  Why do we continue after that?  Is there some case
> where a user program would expect mprotect to succeed on pages that were not
> mapped by mmap?  There must be some subtlety involving PAGE_WRITECOPY that
> I'm missing.

Nothing like that.  This is following Linux, see the mprotect manpage:

[...]
VERSIONS
   POSIX  says that the behavior of mprotect() is unspecified if it is ap‐
   plied to a region of memory that was not obtained via mmap(2).

   On Linux, it is always permissible to call mprotect() on any address in
   a process's address space (except for the kernel  vsyscall  area).   In
   particular,  it  can  be  used  to  change existing code mappings to be
   writable.
   [...]


Corinna

Reply via email to