[HACK] Re: Who understands this code?

Greg Schafer gschafer at zip.com.au
Fri Mar 14 15:40:58 PST 2003


On Sat, Mar 15, 2003 at 09:08:29AM +1100, Greg Schafer wrote:
> On Fri, Mar 14, 2003 at 04:41:00PM -0500, Donald Smith wrote:
> > Instead of bombing on this check, it should just do a second anonymous 
> > mmap on x (or whichever of x and y were mapped first) and recheck for 
> > contiguousness. DO NOT UNMAP the first x, just let it go cause it'll be 
> > released on exit.
> > 
> > If you want to submit the change to the check, just let the gcc guys (or 
> > whoever) know that you encountered a race condition with a small (less 
> > than one memory page) ld.so.cache file that caused the check to fail 
> > incorrectly.
> 
> Like I said, I don't fully understand this stuff. Care to make a patch to
> the test case to demonstrate how the test should be done?

Ok, this is a HACK but it's what I'm going to run with for the time being
unless someone can come up with something better. Works for me.

Greg
-------------- next part --------------
diff -uNr gcc-3.2.2.orig/gcc/configure gcc-3.2.2/gcc/configure
--- gcc-3.2.2.orig/gcc/configure	2003-02-04 11:17:46.000000000 +1100
+++ gcc-3.2.2/gcc/configure	2003-03-15 10:35:01.000000000 +1100
@@ -4210,6 +4210,12 @@
   x = anonmap (pg);
   if (x == (char *)MAP_FAILED)
     perror_exit ("test 3 mmap 1", 14);
+
+/* HACK - repeat the first anonmap so as to avoid a subtle race condition
+   with a small (less than one memory page) ld.so.cache file that causes
+   the check to fail incorrectly.  */
+  x = anonmap (pg);
+
   y = anonmap (pg);
   if (y == (char *)MAP_FAILED)
     perror_exit ("test 3 mmap 2", 15);


More information about the lfs-dev mailing list