Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-12-12 13:00:32 +0300
committerCorinna Vinschen <corinna@vinschen.de>2005-12-12 13:00:32 +0300
commit2193d02b4ddfc329e0817258093a40050b2d582a (patch)
tree111e7e864b2cf654df2c5ec1de6758dc23bf1136
parent4e8e54543e9e9dc20786e1f554d92186f812517e (diff)
* mmap.cc (gen_create_protect): Always generate WRITECOPY protection
for private maps. (fixup_mmaps_after_fork): Fix calculation of WRITECOPY protection for VirtualProtect. Add some words to the comment.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/mmap.cc22
2 files changed, 19 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index dc8f92b72..af716dc92 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2005-12-12 Corinna Vinschen <corinna@vinschen.de>
+
+ * mmap.cc (gen_create_protect): Always generate WRITECOPY protection
+ for private maps.
+ (fixup_mmaps_after_fork): Fix calculation of WRITECOPY protection for
+ VirtualProtect. Add some words to the comment.
+
2005-12-10 Christopher Faylor <cgf@timesys.com>
* dirent.h: Change the rest of the d_ino's to __deprecated_d_ino.
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 2414668b5..ee6382c44 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -98,8 +98,10 @@ gen_create_protect (DWORD openflags, int flags)
{
DWORD ret = PAGE_READONLY;
- if (openflags & GENERIC_WRITE)
- ret = priv (flags) ? PAGE_WRITECOPY : PAGE_READWRITE;
+ if (priv (flags))
+ ret = PAGE_WRITECOPY;
+ else if (openflags & GENERIC_WRITE)
+ ret = PAGE_READWRITE;
/* Ignore EXECUTE permission on 9x. */
if ((openflags & GENERIC_EXECUTE)
@@ -1963,16 +1965,16 @@ fixup_mmaps_after_fork (HANDLE parent)
"address %p, %E", address);
return -1;
}
- else if ((mbi.AllocationProtect & PAGE_WRITECOPY)
+ else if ((mbi.AllocationProtect == PAGE_WRITECOPY
+ || mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY)
&& (mbi.Protect == PAGE_READWRITE
|| mbi.Protect == PAGE_EXECUTE_READWRITE))
- {
- /* A PAGE_WRITECOPY page which has been written to is
- set to PAGE_READWRITE, but that's an incompatible
- protection to set the page to. */
- mbi.Protect &= ~PAGE_READWRITE;
- mbi.Protect |= PAGE_WRITECOPY;
- }
+ /* A WRITECOPY page which has been written to is set to
+ READWRITE, but that's an incompatible protection to
+ set the page to. Convert the protection to WRITECOPY
+ so that the below VirtualProtect doesn't fail. */
+ mbi.Protect <<= 1;
+
if (!ReadProcessMemory (parent, address, address,
mbi.RegionSize, NULL))
{