apt-get crashed with SIGSEGV in __fprintf_chk()

Bug #506342 reported by Nicolò Chieffo
114
This bug affects 24 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Confirmed
Medium
Unassigned
Nominated for Lucid by Ali Utku Selen

Bug Description

Binary package hint: apt

when I run "apt-get dist-upgrade" I always end up with a segmentation fault.
The same when upgrading through synaptic, so I will attach the synaptic .crash too
I suspect that the problem is not in apt-get

ProblemType: Crash
Architecture: amd64
Date: Tue Jan 12 11:31:10 2010
DistroRelease: Ubuntu 10.04
ExecutablePath: /usr/bin/apt-get
Package: apt 0.7.25ubuntu2
ProcAttrCurrent: unconfined (enforce)
ProcCmdline: apt-get dist-upgrade
ProcVersionSignature: Ubuntu 2.6.32-10.14-generic
SegvAnalysis:
 Segfault happened at: 0x7fd7af4d94af <__fprintf_chk+95>: cmpw $0x0,(%rdi)
 PC (0x7fd7af4d94af) ok
 source "$0x0" ok
 destination "(%rdi)" (0x00000000) not located in a known VMA region (needed writable region)!
SegvReason: writing NULL VMA
Signal: 11
SourcePackage: apt
StacktraceTop:
 __fprintf_chk () from /lib/libc.so.6
 pkgDPkgPM::CloseLog() ()
 pkgDPkgPM::Go(int) ()
 pkgPackageManager::DoInstallPostFork(int) ()
 ?? ()
Tags: lucid
Title: apt-get crashed with SIGSEGV in __fprintf_chk()
Uname: Linux 2.6.32-10-generic x86_64
UserGroups:

Revision history for this message
Nicolò Chieffo (yelo3) wrote :
Revision history for this message
Nicolò Chieffo (yelo3) wrote :
Revision history for this message
Apport retracing service (apport) wrote :

StacktraceTop:
 ___fprintf_chk (fp=0x0, flag=1, format=0x7fd7b01b4e46 "End-Date: %s\n")
 pkgDPkgPM::CloseLog (this=<value optimized out>)
 pkgDPkgPM::Go (this=0x9097b0,
 pkgPackageManager::DoInstallPostFork (
 InstallPackages (Cache=<value optimized out>,

Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt
Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt
Changed in apt (Ubuntu):
importance: Undecided → Medium
tags: removed: need-amd64-retrace
visibility: private → public
Changed in apt (Ubuntu):
status: New → Confirmed
Revision history for this message
Ali Utku Selen (auselen) wrote :

I think crash happens because code snippet below (from apt-pkg/deb/dpkgpm.cc:656) does not check if history_out is valid.

   string history_name = flCombine(_config->FindDir("Dir::Log"),
                                   _config->Find("Dir::Log::History"));
   if (!history_name.empty())
   {
      FILE *history_out = fopen(history_name.c_str(),"a");
      fprintf(history_out, "End-Date: %s\n", timestr);
      fclose(history_out);
   }

Problem gets triggered for me because my Dir::Log directory does not exists, due to the fact I've mounted my /var/log to a tmpfs.

$apt-config dump
...
Dir::Log "var/log/apt";
Dir::Log::Terminal "term.log";
Dir::Log::History "history.log";
...

I can confirm issue has disappeared after I've created directory manually.

Revision history for this message
Ali Utku Selen (auselen) wrote :

Here is a patch to fix the problem. I've tested it with latest apt bzr branch.
After changes, apt-get logs the following lines instead of giving a segmentation fault.

E: Directory '/var/log/apt/' missing
E: Directory '/var/log/apt/' missing

Revision history for this message
Ubfan (ubfan1) wrote :

I mount my /var/log on a ramfs (since I run off a 4G thumbdrive), and worked around the problem by creating any necessary directories in rc.local. I've also created in rc.local a link from /var/cache/apt to a /tmp/debs (with /tmp mounted as tmpfs) and create the /archives/partial directory (path). Postgres also needs a directory. This setup puts some of the most active write locations into ram, instead of (slow) flash, which has a limited lifespan.

Revision history for this message
Bruno Clermont (b.clermont-deactivatedaccount) wrote :

Look like 595795

Revision history for this message
Philip Muškovac (yofel) wrote :

I'll mark this bug as a dup of bug 535509 as we already have a branch attached there.

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.