Skip to contentSkip to conversation

SIGSEGV in __pthread_initialize_minimal_internal ()

Buildroot Johannes Morgenroth 2 participants 4 messages Feb 6, 2014 – Feb 7, 2014

lore
Share & tools
lore
#0 lore raw

Hello.

I try to compile a DTN stack (IBR-DTN) as static binary using buildroot. Formerly with the release 2012.02 this wasn't an issue, but since my recent system no longer compile the old release, I tried the new one but without any luck. Any static binary I compile exists with a SIGSEGV. To reproduce my set-up, I pushed my repository (based on the recent master) to github.
https://github.com/ibrdtn/buildroot.git

I used the configuration stored in the added default configuration 'ibrdtn_x86_defconfig'. So my steps are...

$ make ibrdtn_x86_defconfig
$ make
(get a coffee)
$ ./output/target/usr/sbin/dtnd --version
Segmentation fault (core dumped)

To investigate that fault, I compiled the toolchain with debug symbols and the GDB points me to __pthread_initialize_minimal_internal ().

$ gdb --args ./output/build/ibrdtnd-0.10.2/src/dtnd
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ./output/build/ibrdtnd-0.10.2/src/dtnd...done.
(gdb) r
Starting program: ./output/build/ibrdtnd-0.10.2/src/dtnd

Program received signal SIGSEGV, Segmentation fault. 0x082b81f1 in __pthread_initialize_minimal_internal () (gdb) bt

#0  0x082b81f1 in __pthread_initialize_minimal_internal ()
#1  0x08408797 in __uClibc_init ()
#2  0x08408939 in __uClibc_main ()
#3  0x08049111 in _start ()

(gdb)

I assume this may has to do with some sort of order issues while linking the libraries, but I am not sure and have no idea where to start with the debugging. Any help or advice is appreciated.

Thanks!
Johannes

Signature · 3 lines
Johannes Morgenroth     Institut fuer Betriebssysteme und Rechnerverbund
Tel.: +49-531-391-3249                           Muehlenpfordtstrasse 23
Fax.: +49-531-391-5936      TU Braunschweig         D-38106 Braunschweig
#1 lore raw
Quoted 10 lines · Johannes Morgenroth

Hello.

I try to compile a DTN stack (IBR-DTN) as static binary using buildroot. Formerly with the release 2012.02 this wasn't an issue, but since my recent system no longer compile the old release, I tried the new one but without any luck. Any static binary I compile exists with a SIGSEGV. To reproduce my set-up, I pushed my repository (based on the recent master) to github.
https://github.com/ibrdtn/buildroot.git

Quoted 7 lines

I used the configuration stored in the added default configuration 'ibrdtn_x86_defconfig'. So my steps are...

$ make ibrdtn_x86_defconfig
$ make
(get a coffee)
$ ./output/target/usr/sbin/dtnd --version

You're trying to use the cross-compiled binary directly on your host.
This may work by accident, but may not work as well. In this particular case, I suspect it may be an issue with kernel headers: the cross-build is using 3.13.x while your host is probably running an earlier kernel.

Try running it under a system qemu so you have the corresponding kernel,
or build the toolchain with kernel headers corresponding to your host.

Regards,
Arnout

Quoted 36 lines

Segmentation fault (core dumped)

To investigate that fault, I compiled the toolchain with debug symbols and the GDB points me to __pthread_initialize_minimal_internal ().

$ gdb --args ./output/build/ibrdtnd-0.10.2/src/dtnd
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ./output/build/ibrdtnd-0.10.2/src/dtnd...done.
(gdb) r
Starting program: ./output/build/ibrdtnd-0.10.2/src/dtnd

Program received signal SIGSEGV, Segmentation fault. 0x082b81f1 in __pthread_initialize_minimal_internal () (gdb) bt

#0  0x082b81f1 in __pthread_initialize_minimal_internal ()
#1  0x08408797 in __uClibc_init ()
#2  0x08408939 in __uClibc_main ()
#3  0x08049111 in _start ()

(gdb)

I assume this may has to do with some sort of order issues while linking the libraries, but I am not sure and have no idea where to start with the debugging. Any help or advice is appreciated.

Thanks!
Johannes

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

Hello Arnout,

thank you for the response.

Am 06.02.2014 22:02, schrieb Arnout Vandecappelle:

Quoted 10 lines

You're trying to use the cross-compiled binary directly on your host.
This may work by accident, but may not work as well. In this particular case, I suspect it may be an issue with kernel headers: the cross-build is using 3.13.x while your host is probably running an earlier kernel.

Try running it under a system qemu so you have the corresponding kernel,
or build the toolchain with kernel headers corresponding to your host.

Regards,
Arnout

The binary is compiled using and for x86. Thus, starting on the same system should work and actually it had worked with older releases (at least with 2012.02). I could not test the kernel issue you mentioned because the system runs a 3.8 and buildroot only support older or newer one. I tried both 3.2 and 3.13, none of them had worked. However, I do not understand why a statically linked binary should depend on the system kernel it runs on. Also this was never an issue with release 2012.02.

Kind regards,
Johannes Morgenroth

Signature · 3 lines
Johannes Morgenroth     Institut fuer Betriebssysteme und Rechnerverbund
Tel.: +49-531-391-3249                           Muehlenpfordtstrasse 23
Fax.: +49-531-391-5936      TU Braunschweig         D-38106 Braunschweig
#3 lore raw
In reply to Johannes Morgenroth

I do not know why, but disabling SSP (stack protection) allows to generate working binaries again.
Maybe now anyone can tell me why that is an issue?

Kind regards,
Johannes Morgenroth

Am 06.02.2014 17:05, schrieb Johannes Morgenroth:

Quoted 23 lines
$ gdb --args ./output/build/ibrdtnd-0.10.2/src/dtnd
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 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 "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ./output/build/ibrdtnd-0.10.2/src/dtnd...done.
(gdb) r
Starting program: ./output/build/ibrdtnd-0.10.2/src/dtnd

Program received signal SIGSEGV, Segmentation fault. 0x082b81f1 in __pthread_initialize_minimal_internal () (gdb) bt

#0  0x082b81f1 in __pthread_initialize_minimal_internal ()
#1  0x08408797 in __uClibc_init ()
#2  0x08408939 in __uClibc_main ()
#3  0x08049111 in _start ()

(gdb)

Signature · 3 lines
Johannes Morgenroth     Institut fuer Betriebssysteme und Rechnerverbund
Tel.: +49-531-391-3249                           Muehlenpfordtstrasse 23
Fax.: +49-531-391-5936      TU Braunschweig         D-38106 Braunschweig