Insuffisient permissions make apport-gtk crash with KeyError in __getitem__()

Bug #198543 reported by Till Ulen
52
This bug affects 6 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
Undecided
Martin Pitt

Bug Description

Binary package hint: apport

Bug #129146 is about handling the case when the crash report is not readable. Bug #198526 is about the case when it is readable but not writable.

I stumbled upon yet another bug in apport where it crashes while processing a report that is both readable and writable but is not owned by the current user. After the crash the original report is *destroyed*. The file is truncated to zero length.

How to reproduce:

1. Crash a program running with root privileges. I used bug #67995 to crash Synaptic.

2. Find the newly created report in /var/crash and change its group and permissions so that it is readable and writable by your current user, but root is still the owner:
    $ cd /var/crash
    $ ls -l _usr_sbin_synaptic.0.crash
    -rw------- 1 root root 5152387 2008-03-05 02:23 _usr_sbin_synaptic.0.crash
    $ sudo chgrp username _usr_sbin_synaptic.0.crash
    $ sudo chmod g+rw _usr_sbin_synaptic.0.crash

3. Open the crash report under your current user. Apport will crash.

4. The original crash report is now erased:
    $ ls -l _usr_sbin_synaptic.0.crash
    -rw-rw---- 1 root username 0 2008-03-05 03:30 _usr_sbin_synaptic.0.crash

Step one can actually be omitted, but this scenario is intended to show how you can run into this problem in real life. When I did, I didn't realize that it was not enough to give apport read and write permissions to the crash report in order to send it.

The traceback for this bug coincides with that of bug #147113. I don't know whether they are the same problem or two different problems with similar symptoms.

As for bug #151678, which is a duplicate of #147113, please note the unusual permissions of the report that caused apport to crash: <http://launchpadlibrarian.net/9947596/CrashReports.txt>

0:0:0:0:2007-10-11 12:51:04.000000000 -0700:2007-10-11 12:56:38.000000000 -0700:/var/crash/_usr_lib_gnome-applets_mixer_applet2.0.crash

The mode is 0, nobody has any permissions for that file.

Hope this helps.

ProblemType: Crash
Architecture: i386
CrashReports:
 660:0:1001:0:2008-03-05 03:30:44.000000000 +0600:2008-03-05 02:21:45.000000000 +0600:/var/crash/_usr_sbin_synaptic.0.crash
 600:1001:1001:17929:2008-03-05 03:30:43.000000000 +0600:2008-03-05 03:30:44.000000000 +0600:/var/crash/_usr_share_apport_apport-gtk.1001.crash
Date: Wed Mar 5 03:30:44 2008
DistroRelease: Ubuntu 7.10
ExecutablePath: /usr/share/apport/apport-gtk
InterpreterPath: /usr/bin/python2.5
Package: apport-gtk 0.98
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/share/apport/apport-gtk -c /var/crash/_usr_sbin_synaptic.0.crash
ProcCwd: /home/users/alexkon
ProcEnviron:
 PATH=/home/users/alexkon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/share/apport/apport-gtk', '-c', '/var/crash/_usr_sbin_synaptic.0.crash']
SourcePackage: apport
Title: apport-gtk crashed with KeyError in __getitem__()
Uname: Linux chronos 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux

Tags: apport-crash
Revision history for this message
Till Ulen (tillulen) wrote :
Till Ulen (tillulen)
description: updated
Daniel T Chen (crimsun)
Changed in apport:
status: New → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

trunk r1545

Changed in apport (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.3 KiB)

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

---------------
apport (1.8.1-0ubuntu1) karmic; urgency=low

  * New upstream bug fix release:
    - data/general-hooks/generic.py: Check $HOME, not /home for enough space.
      (LP: #422658)
    - launchpad.py: Intercept httplib2.ServerNotFoundError as well, to avoid
      crashes when being offline. (LP: #396276)
    - apport-cli: Save reports with .apport extension instead of .txt. Thanks
      to Steve Beattie! (LP: #401983)
    - fileutils.py, likely_packaged(): Ignored crashes in /var, packages don't
      ship executables there, and it creates false positives. (LP: #414368)
    - packaging-apt-dpkg.py, get_modified_files(): Fix crash with empty lines.
      (LP: #408280)
    - packaging-apt-dpkg.py: Use installed version instead of candidate
      version where appropriate. This also fixes a crash where an obsolete
      package is not available any more. (LP: #423511)
    - hookutils.py, attach_gconf(): Fix crash with keys which do not have a
      schema default. (LP: #422277)
    - launchpad.py: Remove LP #353805 workaround, seems fixed now.
    - launchpad.py: Talk to staging if $APPORT_STAGING is set.
    - launchpad.py: Explicitly supply content_type for addAttachment, current
      wadllib requires it now.
    - apport_python_hook.py: Paper over inexplicable import error.
      (LP: #348250)
    - apport_python_hook.py: Protect against nonexisting sys.argv.
      (LP: #418051)
    - apport/ui.py, load_report(): Check that report has ProblemType field.
      (LP: #198543)
    - ui.py: Fix handling of complete vs. reduced report size. (LP: #92653).
      This also fixes a race condition crash with os.path.getsize().
      (LP: #348137)
    - fi.po: Fix mistranslation of "&Cancel". (LP: #355303)
    - apport-{gtk,kde}: Check for having $DISPLAY at startup to avoid crashes.
      (LP: #411276)
    - report.py, add_gdb_info(): Fix race condition in unlink_core, thanks to
      Tommi Komulainen! (LP: #397945)
    - ui.py, load_report(): Robustify check whether program is still
      installed. (LP: #329184)
    - packaging-apt-dpkg.py, install_retracing_packages(): Install package for
      ExecutablePath/InterpreterPath if missing; this can happen with package
      hooks which reassing package
    - launchpad.py: Add a comment when marking a bug as a duplicate.
      (LP: #418871)
  * Move gdb dependency from apport to GUI packages to avoid pulling in gdb on
    Ubuntu server. Thanks to Steve Beattie! (LP: #354172)
  * ubuntu-bug: Fix handling of .crash file arguments, thanks to Marco
    Rodrigues for pointing this out! (LP: #422881)
  * debian/local/apport-collect: Set content_type and description, wadllib
    requires them now. (LP: #423512) Also drop the ASCII reencoding
    workaround, this doesn't seem to be necessary any more.
  * apport/hookutils.py, attach_conffiles(): Fix crash with obsolete
    conffiles. (LP: #412132)
  * debian/local/apport-collect: Do not upload data if the affected package
    isn't installed and there is no source package hook available either.
    (LP: #417277)
  * debian/local/ubuntu-bug: Accept .apport extension, too; thanks to Steve
    ...

Read more...

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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