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

Tim Robbins tjr at freebsd.org
Thu Jun 12 05:29:14 PDT 2003


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


More information about the freebsd-current mailing list