nih uses eglibc private symbol __abort_msg

Bug #997359 reported by James Hunt
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libnih
Confirmed
Undecided
Unassigned
apport (Ubuntu)
Fix Released
High
Martin Pitt
Precise
Won't Fix
Undecided
Unassigned
Quantal
Won't Fix
Undecided
Unassigned
Raring
Fix Released
High
Martin Pitt
libnih (Ubuntu)
Fix Released
High
James Hunt
Precise
Won't Fix
Undecided
Unassigned
Quantal
Won't Fix
Undecided
Unassigned
Raring
Fix Released
High
James Hunt

Bug Description

NIH uses the private eglibc '__abort_msg' symbol to save a string explaining why nih_assert() failed. However, __abort_msg is not a public symbol which causes problems when libc is upgraded - it actually necessitates that for every libc upgrade on, for example, Ubuntu systems the following has to happen:

1) eglibc is upgraded with a version set to <version>~foo
2) nih is rebuilt against the eglibc version
3) nih is upgraded.
4) the eglibc package is upgraded *again* to drop the ~foo.

The symbol can be made use of like this:

$ cat >foo.c<<EOF
int
main(int argc, char *argv[])
{
    nih_log_set_priority (NIH_LOG_FATAL);
    nih_assert (0 == 1);

    exit (EXIT_SUCCESS);
}
EOF
$ gcc -std=gnu99 -g -Wall -pedantic -o foo foo.c `pkg-config --cflags --libs libnih`
$ ./foo
(null):nih_make_core.c:46: Assertion failed in main: 0 == 1
Aborted (core dumped)
$ gdb foo core.1597
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu1) 7.4-2012.04
Copyright (C) 2012 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/james/src/c/foo...done.
[New LWP 1597]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Core was generated by `foo'.
Program terminated with signal 6, Aborted.
#0 0xb770d1b2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) p (char *)__abort_msg
$1 = 0x93fa098 "nih_make_core.c:46: Assertion failed in main: 0 == 1"
(gdb)

Related branches

James Hunt (jamesodhunt)
description: updated
Revision history for this message
James Hunt (jamesodhunt) wrote :

The __abort_msg symbol is used specifically to work with apport (/usr/share/pyshared/apport/report.py) to provide enriched crash reporting.

Revision history for this message
James Hunt (jamesodhunt) wrote :

Maybe apport should be modified to special case a new NIH-specific symbol that isn't tied to glibc?

Changed in apport (Ubuntu):
importance: Undecided → High
Changed in libnih (Ubuntu):
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apport (Ubuntu):
status: New → Confirmed
Changed in libnih (Ubuntu):
status: New → Confirmed
Micah Gersten (micahg)
tags: added: rls-q-incoming
Steve Langasek (vorlon)
tags: added: rls-q-notfixing
removed: rls-q-incoming
Revision history for this message
James Hunt (jamesodhunt) wrote :

Responding to my own comment #2, I don't see why we can't change NIH to create its own '__nih_abort_msg' symbol as long as apport can be tweaked to also look for this symbol.

James Hunt (jamesodhunt)
Changed in libnih (Ubuntu Raring):
assignee: nobody → James Hunt (jamesodhunt)
James Hunt (jamesodhunt)
Changed in libnih (Ubuntu Raring):
status: Confirmed → Fix Released
Revision history for this message
James Hunt (jamesodhunt) wrote :

NIH in Ubuntu (not yet upstream) now uses __nih_abort_msg such that apport will be able to do:

    (gdb) print (char *)__nih_abort_msg

... to retrieve the abort message.

Martin Pitt (pitti)
Changed in apport (Ubuntu Raring):
assignee: nobody → Martin Pitt (pitti)
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

This is a simple test script which produces an assertion with libnih. Running it will build the simple .c program, run it, and run gdb on the core dump.

(gdb) p __nih_abort_msg
No symbol "__nih_abort_msg" in current context.

That's libnih-dev 1.0.3-4ubuntu12 in current raring. It might be that this requires the debugging symbols to be installed, but libnih doesn't build a libnih1-dbg so this is difficult to capture in a test case.

Is this the right approach/script/symbol?

Revision history for this message
James Hunt (jamesodhunt) wrote :

Hi Martin - updated script attached.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks James! D'oh, so I just picked a wrong include.

Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in apport trunk r2536.

Changed in apport (Ubuntu Raring):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.6.3-0ubuntu1

---------------
apport (2.6.3-0ubuntu1) raring; urgency=low

  * New upstream release. Changes since our previous snapshot:
    - debian.py: Only reject reports with useless stack traces if the report
      actually has a stack trace at all.
    - debian.py: Fix UTF-8 string handling. Thanks Ritesh Raj Sarraf.
    - debian.py: Fix crash on broken "Package" fields, as generated by current
      Debian/Ubuntu dkms package.
    - data/apport: Call fsync when writing upstart crash reports.
    - report.py, add_gdb_info(): Handle libnih's assertion messages.
      (LP: #997359)
    - apport-gtk, apport-kde: Don't provide an option to restart a crashed
      application when the crash occurred in a thread (LP: #1033902).
    - apport-retrace: Disallow option -C without option -S. Thanks Kyle
      Nitzsche.
    - fileutils.py, mark_report_upload(): Refresh the .upload stamps if a
      previous version of the report was already uploaded, but another
      instance of the problem happened since then. Thanks Brian Murray. (LP:
      #1084296)
    - Ignore implausibly low addresses when computing
      StacktraceAddressSignature. These are usually artifacts from gdb when
      not having debug symbols, and having too many of them prevents proper
      client-side duplicate detection and proper bucketing in daisy.
      (LP: #1084996)
    - fileutils.py: Ignore .desktop files with NoDisplay=true. (LP: #1048524)
  * debian/tests/control: Run tests as root, just like before switching our
    autopkgtests to run as user "ubuntu" by default. This enables a couple of
    extra tests, and avoids some confusion because the distro and the user
    name are identical.
  * data/package-hooks/source_linux-nexus7.py: Fix PEP-8 error.
 -- Martin Pitt <email address hidden> Fri, 30 Nov 2012 18:00:01 +0100

Changed in apport (Ubuntu Raring):
status: Fix Committed → Fix Released
Changed in libnih:
status: New → Confirmed
Changed in apport (Ubuntu Quantal):
status: New → Won't Fix
Changed in libnih (Ubuntu Quantal):
status: New → Won't Fix
Revision history for this message
Steve Langasek (vorlon) wrote :

The Precise Pangolin has reached end of life, so this bug will not be fixed for that release

Changed in apport (Ubuntu Precise):
status: New → Won't Fix
Changed in libnih (Ubuntu Precise):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.