delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/06/27/02:03:43

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
Subject: RE: pthreads works, sorta
MIME-Version: 1.0
Date: Wed, 27 Jun 2001 15:48:03 +1000
Message-ID: <EA18B9FA0FE4194AA2B4CDB91F73C0EF08F0A6@itdomain002.itdomain.net.au>
content-class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: pthreads works, sorta
Thread-Index: AcD+y8xwtUaa1T59RBOupk5BbTZiDQAAA7uA
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: "Dmitry Timoshkov" <dmitry AT baikal DOT ru>, "Greg Smith" <gsmith AT nc DOT rr DOT com>,
<cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id CAA32585

> -----Original Message-----
> From: Dmitry Timoshkov [mailto:dmitry AT baikal DOT ru]
> Sent: Wednesday, June 27, 2001 4:51 PM
> To: Robert Collins; Greg Smith; cygwin AT cygwin DOT com
> Subject: Re: pthreads works, sorta
> 
> 
> "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au> wrote:
> 
> [skipped]
> 
> > What does all this mean? We need to catch invalid memroy access, and
> > ValidQuery was supplied by Chris as a tool to do that.
> 
> In a multithreaded environment VirtualQuery, IsBad* and 
> similar approaches
> are wrong. It can't be guaranteed that after a successful 
> test that memory
> will be still accessable.

It's kernel allocated memory we are checking against (the user cannot
free it from under us). The function does the following:
check the pointer is not null
check the pointer is into mapped address space.
check the type of the structure it's pointing into is correct (ie a
thread object).

The main reason for the readable address check is to prevent the process
hanging because a signal is generated in cygwin's pthread code due to
bad userland variable values (threads are used to handle signals and
thus signals from the pthreads code never gets processed). The race
protection is dealt with (not completely yet) elsewhere.

I agree with the principle that you describe however.
 
> > So the question for all the win32 gurus:
> > 
> > Whats a fast way to catch (in-cygwin-dll) invalid memory 
> access's. Can
> > we use structed exception handling there? Or...?
> 
> Using SEH is probably a way to go.

SEH uses pthreads in multithreaded applications. Will SEH work reliably
in the pthreads code? 

Rob

> --
> Dmitry.
> 
> 
> --
> 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/
> 
> 

--
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