Bug 435985 - Static programs crash
Static programs crash
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
rawhide
All Linux
low Severity urgent
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-04 14:06 EST by Gary Thomas
Modified: 2008-04-08 08:14 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-08 08:14:10 EDT
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 Gary Thomas 2008-03-04 14:06:06 EST
Description of problem:

Building some programs with -static crash immediately (in dl_init())

Version-Release number of selected component (if applicable):

Fedora 8 (2.7-2) or rawhide (2.7.90-7)

How reproducible:

Every time with some programs

Steps to Reproduce:
1. Build qemu-0.9.1-4.fc9.src.rpm
2. Change 'spec' file in the %build section
   "--enable-alsa" => "--static"
   This enables static builds and disables ALSA (I couldn't find a
   static libassound)
3. Execute one of the Linux tools, e.g. qemu-ppc
  
Actual results:


Expected results:


Additional info:

On rawhide, the static executables die immediately (and totally
mess with GDB):
mock-chroot> gdb /usr/src/redhat/BUILD/qemu-0.9.1/ppc-linux-user/qemu-ppc GNU
gdb Red Hat Linux (6.7.1-13.fc9rh)
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r
Starting program: /usr/src/redhat/BUILD/qemu-0.9.1/ppc-linux-user/qemu-ppc 
Cannot access memory at address 0x5f737973

On Fedora8, the result is different, but still immediately fatal.
GDB traceback of the failure shows it happens very early on:

[root@hpl-gary SPECS]# gdb /usr/src/redhat/BUILD/qemu-0.9.1/ppc-linux-user/qemu-ppc
GNU gdb Red Hat Linux (6.6-43.fc8rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r
Starting program: /usr/src/redhat/BUILD/qemu-0.9.1/ppc-linux-user/qemu-ppc 

Program received signal SIGSEGV, Segmentation fault.
0x6007110c in ptmalloc_init ()
(gdb) bt
#0  0x6007110c in ptmalloc_init ()
#1  0x60072186 in malloc_hook_ini ()
#2  0x600706d8 in malloc ()
#3  0x6009fa1c in _dl_init_paths ()
#4  0x6007952c in _dl_non_dynamic_init ()
#5  0x60079df6 in __libc_init_first ()
#6  0x60058ccd in __libc_start_main ()
#7  0x60000171 in _start ()
Comment 1 Gary Thomas 2008-03-05 04:27:35 EST
BTW, this same process works when built with older versions of GLIBC.
In particular glibc-2.3.6-0.fc3.1

I built and tested on FC3 (yes, they still exist!) and the static versions
of the programs execute properly.
Comment 2 Jakub Jelinek 2008-04-08 08:14:10 EDT
That's a qemu bug.  Using kernel linker script to link is a very dumb idea for
many reasons.  In this particular case the linker script omits .tdata/.tbss
sections which must be consecutive, but because of the linker are not.

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