Wierd sparc sunos4 intermittant SEGV during bootstrap in libgcc2.a

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sat Mar 11 06:30:00 GMT 2000


 > From: Jim Wilson <wilson@cygnus.com>
 > 
 > 	Do you know of a way to reliably detect this bug in strncmp and test
 > 	for it in autoconf?  If so, I can write something for libiberty and
 > 	provide a replacement strncmp.
 > 
 > I don't have any simple testcase, but it is very reproducible on the
 > SunOS4 machine here.
 > 
 > strncmp has code to compare 4 bytes at a time.  If you pass an
 > unaligned string, then it reads a word ahead, and then extracts an
 > aligned word from the 8 bytes that it read.  So if you put a string
 > near the end of memory, and the string is not 4 byte aligned, and you
 > pass it as the second argument to strncmp, you can get a read past the
 > end of memory when it tried to extract an aligned word.

Okay, that's very informative thanks.  I definitely don't see the
deterministic strncmp error on my box and I think I might know why.
The RutgersU sunos4 practice was to upgrade kernels but leave files
alone.  Its quite possible that the system I have access to has an
older libc.so (pre-4.1.4) that doesn't do word-at-a-time strncmp.  I
know this means that my config is non-standard, which is part of the
reason why I was asking if anyone else saw my problem of intermittant
crashes on a sun4m arch.  All the other sun boxes I have access to are
solaris, I'll see if I can find a solaris sun4m which has the same
problem.

Regarding a testcase, would it be suitable to simply mmap a pagesized
region, put a 5 byte string at the end of it and pass that string as
the second arg to strncmp?  If so, I can whip one up and send it to
you for verification, and then put in a libiberty byte-at-a-time
strncmp backup in place.


 > 
 > 	(BTW, are you saying you *don't* think it has to do with the sparc
 > 	flush instructions or just that I should check mmap first?)
 > 
 > I was just reporting a bug that I knew about, that I suspected you did
 > not know about.  I was not making any comment on the sparc flush
 > instruction.
 > Jim

Okay thanks I appreciate that.  I thought since you fixed the original
intermittant problem years ago I might have been able to tickle one of
your memory cells.  I guess I'll have to wait and see if anyone else
with a sun4m reports a similar problem on sunos4.

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


More information about the Gcc-bugs mailing list