Re: Apparent i386 alloca.S bug (was: adsl/pppoe no longer connecting on 5.1)

From: Tim Robbins <tjr_at_freebsd.org>
Date: Thu, 12 Jun 2003 22:22:07 +1000
On Thu, Jun 12, 2003 at 06:29:44PM +1000, Tim Robbins wrote:

> Here's a test program for the i386 alloca() bug. Compile with -std=gnu89 (or
> no -std option) and it works fine. Compile with -std=c99 or -std=c89 and it
> breaks like this:
> 
> corruption: 05 should be 0xcc at offset 0
> corruption: 00 should be 0xcc at offset 1
> corruption: 00 should be 0xcc at offset 2
> corruption: 00 should be 0xcc at offset 3
> 
> Interestingly, gcc -std=c89 on FreeBSD 4.8 doesn't trigger the bug.

I should mention that you need to compile with -march=pentiumpro to trigger
the bug. It's related to the way gcc 3 uses "movl x,y(%esp)" instead of
"pushl x" when passing arguments to a function. I suggest backing out the
commit that made CSTD=c99 the default, so that we go back to using gcc's
builtin alloca() until we figure out how to fix the one in libc.


Tim
Received on Thu Jun 12 2003 - 03:29:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:11 UTC