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 Message-ID: <008201c0ff0d$8fe3c2a0$806410ac@local> From: "Robert Collins" To: , References: <20010627012932 DOT I19058 AT redhat DOT com> <20010627013502 DOT K19058 AT redhat DOT com> Subject: Re: pthreads works, sorta Date: Wed, 27 Jun 2001 23:32:06 +1000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_007F_01C0FF61.60DED220" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-OriginalArrivalTime: 27 Jun 2001 13:20:10.0993 (UTC) FILETIME=[E483A610:01C0FF0B] ------=_NextPart_000_007F_01C0FF61.60DED220 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit changelog: Wed Jun 27 23:30:00 2001 Robert Collins * 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" To: 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 AT nc DOT rr DOT 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/ > > ------=_NextPart_000_007F_01C0FF61.60DED220 Content-Type: application/octet-stream; name="virtualquery.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="virtualquery.patch" ? virtualquery.patch=0A= Index: path.cc=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/winsup/cygwin/path.cc,v=0A= retrieving revision 1.154=0A= diff -u -p -r1.154 path.cc=0A= --- path.cc 2001/06/24 22:26:52 1.154=0A= +++ path.cc 2001/06/27 13:26:33=0A= @@ -3357,8 +3357,7 @@ cygwin_split_path (const char *path, cha=0A= int __stdcall=0A= check_null_empty_path (const char *name)=0A= {=0A= - MEMORY_BASIC_INFORMATION m;=0A= - if (!name || !VirtualQuery (name, &m, sizeof (m)) || (m.State !=3D = MEM_COMMIT))=0A= + if (!name || IsBadWritePtr ((void *) name, sizeof (struct rlimit)))=0A= return EFAULT;=0A= =0A= if (!*name)=0A= Index: resource.cc=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/winsup/cygwin/resource.cc,v=0A= retrieving revision 1.10=0A= diff -u -p -r1.10 resource.cc=0A= --- resource.cc 2001/06/24 22:26:52 1.10=0A= +++ resource.cc 2001/06/27 13:26:33=0A= @@ -105,8 +105,7 @@ extern "C"=0A= int=0A= getrlimit (int resource, struct rlimit *rlp)=0A= {=0A= - MEMORY_BASIC_INFORMATION m;=0A= - if (!rlp || !VirtualQuery (rlp, &m, sizeof (m)) || (m.State !=3D = MEM_COMMIT))=0A= + if (!rlp || IsBadWritePtr (rlp, sizeof (struct rlimit)))=0A= {=0A= set_errno (EFAULT);=0A= return -1;=0A= @@ -141,8 +140,7 @@ extern "C"=0A= int=0A= setrlimit (int resource, const struct rlimit *rlp)=0A= {=0A= - MEMORY_BASIC_INFORMATION m;=0A= - if (!rlp || !VirtualQuery (rlp, &m, sizeof (m)) || (m.State !=3D = MEM_COMMIT))=0A= + if (!rlp || IsBadWritePtr ((void *) rlp, sizeof (struct rlimit)))=0A= {=0A= set_errno (EFAULT);=0A= return -1;=0A= Index: thread.cc=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v=0A= retrieving revision 1.38=0A= diff -u -p -r1.38 thread.cc=0A= --- thread.cc 2001/06/26 14:57:33 1.38=0A= +++ thread.cc 2001/06/27 13:26:34=0A= @@ -739,9 +739,7 @@ verifyable_object::~verifyable_object ()=0A= int __stdcall=0A= check_valid_pointer (void *pointer)=0A= {=0A= - MEMORY_BASIC_INFORMATION m;=0A= - if (!pointer || !VirtualQuery (pointer, &m, sizeof (m))=0A= - || (m.State !=3D MEM_COMMIT))=0A= + if (!pointer || IsBadWritePtr(pointer, sizeof (verifyable_object)))=0A= return EFAULT;=0A= return 0;=0A= }=0A= ------=_NextPart_000_007F_01C0FF61.60DED220 Content-Type: text/plain; charset=us-ascii -- 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/ ------=_NextPart_000_007F_01C0FF61.60DED220--