delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/14/15:42:52

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Sat, 14 Jul 2001 15:42:48 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: execve() fails in a thread under 98/ME
Message-ID: <20010714154248.A12747@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3B509AA3 DOT 3F3AF7FC AT nc DOT rr DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <3B509AA3.3F3AF7FC@nc.rr.com>; from gsmith@nc.rr.com on Sat, Jul 14, 2001 at 03:16:51PM -0400

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019