[Bug 1325503] Re: gdb reports 'corrupt stack' on armhf without symbols

Steve Langasek steve.langasek at canonical.com
Thu Jun 26 00:24:04 UTC 2014


Hi Maxim,

On Wed, Jun 25, 2014 at 11:51:51PM -0000, Maxim Kuvyrkov wrote:
> How was "sleep" and system glibc compiled?

> To get reliable stack traces GDB has to have access to either frame
> pointer (-fno-omit-frame-pointer compiler flag) or to unwind tables
> (-funwind-tables).  In the absence of either of these, GDB has to guess
> where stack frame boundaries are.  In this case GDB guesses wrong.

These binaries are built using the stock compiler flags in Ubuntu.

[...]
arm-linux-gnueabihf-gcc -std=gnu99   -g -O2 -fstack-protector -param=ssp-buffer-size=4 -Wformat -Werror=format-security -DSYSLOG_SUCCESS -DSYSLOG_FAILURE -DSYSLOG_NON_ROOT -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro -o src/sleep src/sleep.o src/libver.a lib/libcoreutils.a  lib/libcoreutils.a
[...]

  https://launchpad.net/ubuntu/+source/coreutils/8.21-1ubuntu5/+build/5843130
  https://launchpad.net/ubuntu/+source/coreutils/8.21-1ubuntu5/+build/5843130/+files/buildlog_ubuntu-trusty-armhf.coreutils_8.21-1ubuntu5_UPLOADING.txt.gz

> The recommended way to get reliable stack traces is to use -funwind-
> tables, which does not have performance penalty (like -fno-omit-frame-
> pointer), and only increases disk footprint of binaries by several
> percent.

If this is recommended, should it be turned on by default in gcc
upstream?

Barring that, should we turn it on by default in our gcc build in Ubuntu, or
in our common distro compiler flags?

>From Michael, I understand that "several percent" here is "on the order of
5%".

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/1325503

Title:
  gdb reports 'corrupt stack' on armhf without symbols

Status in Linaro GDB:
  New
Status in “gdb” package in Ubuntu:
  Confirmed

Bug description:
  [Test Case]
  sleep 120 &
  kill -SEGV %1

  Observe a corrupt stack in the generated crash file.

  Original Report
  ---------------
  On armhf crash files fail to retrace and gdb reports 'corrupt stack' errors

  For example bug 1323241
  Thread 1 (Thread 0xb0b3b450 (LWP 2243)):
  #0  0x00000030 in ?? ()
  No symbol table info available.
  #1  0xa9990cbe in ?? () from /usr/lib/arm-linux-gnueabihf/unity8/qml/Unity/Launcher/libUnityLauncher-qml.so
  No symbol table info available.
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)

  I also tried directly on the device to run an unstripped and stripped
  build of cat and gdb fails to unwind the stack when the binary is
  stripped. The result of this test is:

  == unstripped ==
  Reading symbols from ./cat...done.
  (gdb) run
  Starting program: /home/phablet/tmp/coreutils-8.21/src/cat
  ^C
  Program received signal SIGINT, Interrupt.
  0xb6f6e914 in read () from /lib/arm-linux-gnueabihf/libc.so.6
  (gdb) bt
  #0  0xb6f6e914 in read () from /lib/arm-linux-gnueabihf/libc.so.6
  #1  0x0000b648 in read (__nbytes=65536, __buf=0x19000, __fd=0) at /usr/include/arm-linux-gnueabihf/bits/unistd.h:44
  #2  safe_read (fd=0, buf=buf at entry=0x19000, count=count at entry=65536) at lib/safe-read.c:66
  #3  0x00009ace in simple_cat (bufsize=65536, buf=0x19000 "") at src/cat.c:168
  #4  main (argc=1, argv=<optimized out>) at src/cat.c:730
  (gdb) quit

  == stripped ==
  Reading symbols from ./cat...(no debugging symbols found)...done.
  (gdb) run
  Starting program: /home/phablet/tmp/coreutils-8.21/src/cat
  ^C
  Program received signal SIGINT, Interrupt.
  0xb6f6e914 in read () from /lib/arm-linux-gnueabihf/libc.so.6
  (gdb) bt
  #0  0xb6f6e914 in read () from /lib/arm-linux-gnueabihf/libc.so.6
  #1  0x0000b648 in ?? ()
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)

  I'd expect the same number of frames and addresses when the binary is
  stripped or not with '??' instead of names when it is stripped.

  ProblemType: BugDistroRelease: Ubuntu 14.10
  Package: gdb (not installed)
  Uname: Linux 3.4.0-5-mako armv7l
  ApportVersion: 2.14.3-0ubuntu1
  Architecture: armhf
  Date: Mon Jun  2 11:07:07 2014
  InstallationDate: Installed on 2014-06-02 (0 days ago)
  InstallationMedia: Ubuntu Utopic Unicorn (development branch) - armhf (20140602)SourcePackage: gdb
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdb-linaro/+bug/1325503/+subscriptions



More information about the foundations-bugs mailing list