Segmentation fault when running apt update using libapt-pkg5.90_1.9.2

Bug #1839714 reported by shemgp on 2019-08-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
High
Unassigned

Bug Description

apt update doesn't work after upgrading apt to 1.9.2 with strace:
openat(AT_FDCWD, "/var/lib/apt/lists/lock", O_RDWR|O_CREAT|O_NOFOLLOW, 0640) = 4
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
fcntl(4, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x5e} ---
+++ killed by SIGSEGV (core dumped) +++

downgrading libapt-pkg5.90 to 1.9.1 fixes it.

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: libapt-pkg5.90 1.9.2
ProcVersionSignature: Ubuntu 5.2.0-8.9+test1-generic 5.2.0
Uname: Linux 5.2.0-8-generic x86_64
ApportVersion: 2.20.11-0ubuntu7
Architecture: amd64
CurrentDesktop: GNOME
Date: Sat Aug 10 21:27:42 2019
EcryptfsInUse: Yes
InstallationDate: Installed on 2015-09-28 (1411 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
SourcePackage: apt
UpgradeStatus: Upgraded to eoan on 2019-07-26 (14 days ago)

shemgp (shemgp) wrote :
shemgp (shemgp) wrote :

Replacing acquire.cc from 1.9.1 fixes the crash.

Julian Andres Klode (juliank) wrote :

If you could obtain a backtrack, that would be super useful.

shemgp (shemgp) wrote :

Here's the backtrace:
0x00007ffff7dc4310 in pkgAcquire::Enqueue (this=0x7fffffffdf20, Item=...) at ../apt-pkg/acquire.cc:339
warning: Source file is more recent than executable.
339 if (Config->LocalOnly == true
(gdb) bt
#0 0x00007ffff7dc4310 in pkgAcquire::Enqueue (this=0x7fffffffdf20, Item=...) at ../apt-pkg/acquire.cc:339
#1 0x00007ffff7d874e4 in pkgAcquire::Item::QueueURI (this=<optimized out>, Item=...) at ../apt-pkg/acquire-item.cc:403
#2 0x00007ffff7d98a1b in pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire*, pkgAcqMetaClearSig*, IndexTarget const&, IndexTarget const&) ()
    at ../apt-pkg/acquire-item.cc:2075
#3 0x00007ffff7d98dde in pkgAcqMetaClearSig::pkgAcqMetaClearSig(pkgAcquire*, IndexTarget const&, IndexTarget const&, IndexTarget const&, metaIndex*) ()
    at ../apt-pkg/acquire-item.cc:1886
#4 0x00007ffff7e2e0d3 in debReleaseIndex::GetIndexes (this=<optimized out>, Owner=0x7fffffffdf20, GetAll=@0x7fffffffdeec: false)
    at /usr/include/c++/9/ext/new_allocator.h:80
#5 0x00007ffff7e9fd19 in pkgSourceList::GetIndexes (this=this@entry=0x55555557bd40, Owner=Owner@entry=0x7fffffffdf20, GetAll=<optimized out>, GetAll@entry=false)
    at ../apt-pkg/sourcelist.cc:487
#6 0x00007ffff7eacced in ListUpdate (Stat=..., List=..., PulseInterval=PulseInterval@entry=0) at ../apt-pkg/update.cc:34
#7 0x00007ffff7f584ca in DoUpdate (CmdL=...) at ../apt-private/private-update.cc:72
#8 0x00007ffff7defa4f in CommandLine::DispatchArg (this=this@entry=0x7fffffffe430, Map=<optimized out>, NoMatch=NoMatch@entry=true)
    at ../apt-pkg/contrib/cmndline.cc:369
#9 0x00007ffff7f1f7b7 in DispatchCommandLine (CmdL=..., Cmds=std::vector of length 31, capacity 32 = {...}) at /usr/include/c++/9/bits/stl_iterator.h:806
#10 0x00005555555563ea in main (argc=2, argv=0x7fffffffe588) at ../cmdline/apt.cc:120

Diffing the 1.9.1 and 1.9.2 acquire shows that pkgAcquire::QueueName was changed.

Changed in apt (Ubuntu):
status: New → Fix Committed
importance: Undecided → High
Julian Andres Klode (juliank) wrote :

Thanks. I could reproduce the issue - it turns out to be a bug that only happens for Acquire::Queue-Mode=access - which is not the default and did not have any test case.

I have a fix pending for it in:
 https://salsa.debian.org/apt-team/apt/merge_requests/73

shemgp (shemgp) wrote :

Thanks for fixing the issue. I can confirm that with commit 7c724251 apt update works in my system now.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 1.9.3

---------------
apt (1.9.3) experimental; urgency=medium

  * Fix segfault in pkgAcquire::Enqueue() with Acquire::Queue-Mode=access
    (LP: #1839714)
  * test: Use valgrind to ensure Acquire::Queue-Mode=access does not crash
  * Add initial support for package patterns (patterns on versions WIP)

 -- Julian Andres Klode <email address hidden> Mon, 19 Aug 2019 16:21:20 +0200

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

Other bug subscribers