This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
guaranteed misalignment
- To: libc-alpha@cygnus.com
- Subject: guaranteed misalignment
- From: marc@laendle
- Date: Thu, 18 Jun 1998 02:03:18 +0200
>Submitter-Id: net
>Originator: Marc Lehmann
>Organization:
>
>Confidential: no
>Synopsis: Guarenteed double mis-alignment in glibc-2.0.94 on x86
>Severity: serious
>Priority: low
>Category: libc
>Class: sw-bug
>Release: libc-2.0.94
>Environment:
Host type: i686-pc-linux-gnu
System: Linux cerebro 2.1.106 #271 SMP Tue Jun 16 03:13:52 CEST 1998 i686
Architecture: i686
Addons: crypt linuxthreads
Build CFLAGS: -O6 -malign-double -mpentiumpro -march=pentiumpro
Build CC: gcc -V1.0.3
Compiler version: gcc driver version pgcc-2.91.41 19980615 (gcc2 ss-980502 experimental) executing egcs-2.90.29
Kernel headers: 2.1.106
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: no
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
I believe the change
1998-03-06 17:04 Ulrich Drepper <drepper@cygnus.com>,
* sysdeps/i386/elf/start.S: Don't call main directly, call
__libc_start_main instead.
Breaks stack alignment on x86 by misaligning the stack on a non-8-byte
boundary.
>How-To-Repeat:
Set a breakpoint on main(), p %esp -> %esp will be aligned, which is wrong,
%esp should be aligned _before_ the call instruction.
>Fix:
This (untested) patch hopefully fixes the problem:
1998-06-18 01:09 Marc Lehmann <pcg@goof.com>
* sysdeps/i386/elf/start.S: correct stack alignment
on start.
--- sysdeps/i386/elf/start.S.old Thu Jun 18 01:05:50 1998
+++ sysdeps/i386/elf/start.S Thu Jun 18 01:06:13 1998
@@ -53,6 +53,7 @@
boundary to avoid penalties from misaligned accesses. Thanks
to Edward Seidl <seidl@janed.com> for pointing this out. */
andl $0xfffffff8, %esp
+ pushl %eax
/* Provide the highest stack address to the user code (for stacks
which grow downwards). */