This is the mail archive of the cygwin@cygwin.com 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]

Re: execve() fails in a thread under 98/ME


On Sat, Jul 14, 2001 at 03:16:51PM -0400, Greg Smith wrote:
>One of our developers has found a subtle bug due to the fact
>that PAGE_GUARD is not valid for VirtualAlloc() under 
>Windows 98/ME.  A testcase is provided below.  I don't
>have access to 98/ME so I haven't created the failure myself,
>but I am assured it happens.  I do know the testcase doesn't
>fail under w2k.
>
>Below are the developers comments.
>
>Thanks, Greg
>
>
>It's in Cygwin's code, but in all fairness it's probably not their
>fault.  I suspect this particular part of Cygwin was more than likely
>coded before Microsoft corrected their documentation oversight.
>
>You see, if you look at cygwin's "alloc_stack_hard_way" function (in
>source module "dcrt0.cc"), you'll notice them doing:
>
>
>    if (!VirtualAlloc ((LPVOID) m.BaseAddress, 1, MEM_COMMIT,
>        PAGE_EXECUTE_READWRITE|PAGE_GUARD))
>    api_fatal ("fork: couldn't allocate new stack guard page %p, %E",
>        m.BaseAddress);
>
>
>The only problem is, the "PAGE_GUARD" flag is not supported on Win9x/ME
>platforms!

alloc_stack_hard_way is executed when a fork is performed from something
other than the non-main thread.  I doubt that this problem has anything
specifically to do with execve.

If PAGE_GUARD is not implemented for Windows 9x, then the "solution"
will be "don't do that on Windows 9x".  I'll add a guard against this in
fork when I return from vacation.  I'll have the fork fail with a ENOSYS
or something.

As the author of the original code, I'm not interested in trying to
kludge around this for Windows 9x.  It was hard enough to get right in
its current form.  However, I'll certainly, as always, accept patches.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]