This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BUG] mprotect() on Windows NT 5+


Hello dear Cygwin developpers !


This is my first post here, so I would like to begin by sending you a big thank 
for Cygwin ! This is a great tool to port programs to Windows.


I think I found a bug in mprotect() implementation. This call is unable to set 
some protections (PROT_READ|PROT_WRITE for example) on a given memory area, 
while it can set some others (PROT_NONE or PROT_READ for example) on the same 
memory area. From my tests, it seems to happen only on WNT5+ (ie. Windows 2000 
and Windows XP - detailed results below).

I upgraded my whole Cygwin setup to confirm the problem is still alive. I also 
searched the web, FAQ, and ML archive without success before posting here.

I wrote a simple testcase to allow you to reproduce the bug. You'll find the 
source code as an attachement to this mail (to compile with "gcc -o 
testcase.exe testcase.c" and to run with "./testcase.exe"). This testcase 
allocate a block of memory with mmap(), fill it with memset(), plays with its 
protection with mprotect() and fill it again with memset().

I ran this test on various Windows flavour available around. Here are the 
results :

Windows OS                Lang   Result
------------------------- ------ ----------------------------------------
W98                       French OK
WNT4 SP6 (Workstation)    French OK
WNT4 SP6 (Server)         French OK
W2K SP4 (Professional)    French mprotect() (3) failed : Invalid argument
W2K SP4 (Advanced server) French mprotect() (3) failed : Invalid argument
WXP SP1 (Professional)    French mprotect() (3) failed : Invalid argument

Of course I'm ready to dig more if needed. But I really need some help since 
I'm not familiar with Cygwin source code, nor with Windows developpement.


For the curious, I discovered this bug while trying to support ARAnyM's m68k 
JIT compiler on Cygwin. ARAnyM (http://aranym.atari.org) is a free (GPLed) 
virtual Atari-compatible system.


Best Regards, and thanks in advance for any help,


Xavier

Attachment: testcase.c
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]