Bug 186924 - Broken x86_64 32-bit vDSOs
Broken x86_64 32-bit vDSOs
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
rawhide
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: Dave Jones
Brian Brock
:
Depends On:
Blocks: FC5Update
  Show dependency treegraph
 
Reported: 2006-03-27 10:14 EST by Jakub Jelinek
Modified: 2015-01-04 17:26 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-29 15:54:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jakub Jelinek 2006-03-27 10:14:13 EST
GCC 4.1 (and current trunk) on x86_64 doesn't create 32-bit but 64-bit object
when gcc -m64 -m32 something.S is called (unlike plain gcc -m32 something.S).
I've opened http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26885
but it is not clear if that will be considered a bug (many similar combination
of switches don't work on many arches, -m64 -m32 just happened to work as
sole -m32 in the past) and it might take time to resolve it.
arch/x86_64/ia32/ when building 32-bit vDSO uses -m64 -m32 and the end result
is that the vDSO is totally broken on x86_64 in FC5ish kernels:
Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text.vsyscall    PROGBITS        ffffe400 000400 000010 00  AX  0   0  1
  [ 2] .text.sigreturn   PROGBITS        ffffe500 000500 000008 00  AX  0   0 32
  [ 3] .text.rtsigreturn PROGBITS        ffffe600 000600 000007 00  AX  0   0 32
  [ 4] .note             NOTE            ffffe608 000608 000018 00   A  0   0  4
  [ 5] .eh_frame         PROGBITS        ffffe620 000620 000108 00   A  0   0  4
  [ 6] .shstrtab         STRTAB          00000000 000728 00004c 00      0   0  1

(note, no .dynamic nor .eh_frame_hdr sections) and:
  LOAD           0x000000 0xffffe000 0xffffe000 0x00728 0x00728 R E 0x1000
  DYNAMIC        0x000000 0x00000000 0x00000000 0x00000 0x00000 R   0x4
  NOTE           0x000608 0xffffe608 0xffffe608 0x00018 0x00018 R   0x4
  GNU_EH_FRAME   0x000000 0x00000000 0x00000000 0x00000 0x00000     0x4

This means e.g. that 32-bit programs will segfault as soon as they start using
exceptions through a signal trampoline, and the NULL DYNAMIC can have similarly
fatal effects.

The following patch cures this for me, even if GCC is changed, it wouldn't be
a bad idea not to use conflicting switches anyway:
--- arch/x86_64/ia32/Makefile.jj        2006-03-27 09:09:40.000000000 -0500
+++ arch/x86_64/ia32/Makefile   2006-03-27 10:10:00.000000000 -0500
@@ -2,6 +2,10 @@
 # Makefile for the ia32 kernel emulation subsystem.
 #

+# Avoid gcc -m64 -m32 ... foo.S
+AFLAGS := $(filter-out -m64, $(AFLAGS))
+
+
 obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \
        ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o \
        mmap32.o
@@ -30,11 +34,14 @@ $(obj)/vsyscall-%.so: $(src)/vsyscall.ld

 AFLAGS_vsyscall-sysenter.o = -m32 -Iarch/i386/kernel
 AFLAGS_vsyscall-syscall.o = -m32 -Iarch/i386/kernel
+AFLAGS_syscall32_syscall.o += -m64
+AFLAGS_ia32entry.o += -m64

 ifdef CONFIG_XEN
 AFLAGS_vsyscall-int80.o = -m32 -Iarch/i386/kernel
 CFLAGS_syscall32-xen.o += -DUSE_INT80
-AFLAGS_syscall32_syscall-xen.o += -DUSE_INT80
+AFLAGS_syscall32_syscall-xen.o += -m64 -DUSE_INT80
+AFLAGS_ia32entry-xen.o += -m64

 $(obj)/syscall32_syscall-xen.o: \
        $(foreach F,int80 sysenter syscall,$(obj)/vsyscall-$F.so)

Note, this is not related in any way to the
linux-2.6-signal-trampolines-unwind-info.patch
patch FC5 kernel includes, it has broken EH_FRAME and DYNAMIC segments even
without that.
Comment 1 Dave Jones 2006-03-28 18:18:55 EST
should be fixed in current FC5 update (pending push), and rawhide.

Note You need to log in before you can comment on or make changes to this bug.