Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 Content-Type: text/plain; charset="koi8-r" Date: Wed, 27 Jun 2001 15:48:03 +1000 Message-ID: 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" To: "Dmitry Timoshkov" , "Greg Smith" , Content-Transfer-Encoding: 8bit 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" 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/