This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: pthreads works, sorta - got it
- To: <cygwin at cygwin dot com>,<cygwin-patches at cygwin dot com>
- Subject: Re: pthreads works, sorta - got it
- From: "Robert Collins" <robert dot collins at itdomain dot com dot au>
- Date: Thu, 28 Jun 2001 00:21:11 +1000
- References: <EA18B9FA0FE4194AA2B4CDB91F73C0EF08F09E@itdomain002.itdomain.net.au> <20010627012932.I19058@redhat.com> <20010627013502.K19058@redhat.com> <008201c0ff0d$8fe3c2a0$806410ac@local> <009701c0ff0e$4d796400$806410ac@local>
Got the bug... attached is a correct patch that doesn't break anything
AFAICT.
GCC was optimising the variable access when the macro
check_null_empty-path_errno was used, and accessing the memory area _before_
the readcheck! The overhead of a proper function should be lower than that
of VirtualQueryHowever, so I've made it a function. It could have the guts
of check_null_empty_path copied into it for speed, but that's optional IMO.
Wed Jun 27 23:30:00 2001 Robert Collins <rbtcollins@hotmail.com>
* path.h (check_null_empty_path_errno): Convert to a function
prototype.
* path.cc (check_null_empty_path_errno): New function.
(check_null_empty_path): Change from VirtualQuery to IsBadWritePtr.
* resource.cc (getrlimit): Ditto.
(setrlimit): Ditto.
* thread.cc (check_valid_pointer): Ditto.
----- Original Message -----
From: "Robert Collins" <robert.collins@itdomain.com.au>
To: "Robert Collins" <robert.collins@itdomain.com.au>; <cygwin@cygwin.com>;
<cygwin-patches@cygwin.com>
Sent: Wednesday, June 27, 2001 11:37 PM
Subject: Re: pthreads works, sorta
> The last patch was bad - sorry! (path.cc had a copy-n-pasto).
>
> Rob
> ----- Original Message -----
> From: "Robert Collins" <robert.collins@itdomain.com.au>
> To: <cygwin@cygwin.com>; <cygwin-patches@cygwin.com>
> Sent: Wednesday, June 27, 2001 11:32 PM
> Subject: Re: pthreads works, sorta
>
>
> > changelog:
> >
> > Wed Jun 27 23:30:00 2001 Robert Collins <rbtcollins@hotmail.com>
> >
> > * path.cc (check_null_empty_path): Change from VirtualQuery to
> > IsBadWritePtr.
> > * resource.cc (getrlimit): Ditto.
> > (setrlimit): Ditto.
> > * thread.cc (check_valid_pointer): Ditto.
> >
> >
> > What about the other instances of virtualQuery? Or are the appropriate..
> >
> > Rob (Your humble delegate).
> >
> >
> >
> > ----- Original Message -----
> > From: "Christopher Faylor" <cgf@redhat.com>
> > To: <cygwin@cygwin.com>
> > Sent: Wednesday, June 27, 2001 3:35 PM
> > Subject: Re: pthreads works, sorta
> >
> >
> > > On Wed, Jun 27, 2001 at 01:29:32AM -0400, Christopher Faylor wrote:
> > > >On Wed, Jun 27, 2001 at 01:10:35PM +1000, Robert Collins wrote:
> > > >>> -----Original Message-----
> > > >>> From: Greg Smith [mailto:gsmith@nc.rr.com]
> > > >>
> > > >>>
> > > >>> More experimenting with my home computer, dual pIII 850:
> > > >>>
> > > >>> 1. 117 157 328
> > > >>> 2. 822 1527 ---
> > > >>> 3. 194 240 453
> > > >>> 4. 169 181 516
> > > >>>
> > > >>As usual, I write a missive, then solve the puzzle.
> > > >>
> > > >>try this:
> > > >>
> > > >>
> > > >>int __stdcall
> > > >>check_valid_pointer (void *pointer)
> > > >>{
> > > >> if (!pointer || IsBadWritePtr(pointer, sizeof
(verifyable_object)))
> > > >> return EFAULT;
> > > >> return 0;
> > > >>}
> > > >
> > > >This is not quite the same thing as VirtualQuery. This verifies that
> the
> > > >process can write to memory. It doesn't verify that it is
accessible.
> > > >
> > > >Maybe that is not important but I would have to think about this.
> > > >
> > > >Nice find, though, Rob.
> > >
> > > I've thought about it. IsBadWritePtr should be fine in both
> > check_null_empty_path
> > > and check_valid_pointer.
> > >
> > > Could you submit a patch, Rob? If you are motivated, I'd appreciate a
> > cleanup
> > > patch for resource.cc, too.
> > >
> > > 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/
> > >
> > >
> >
>
virtualquery.patch