[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#803417: marked as done (apt-get: Segfault upon low memory (ENOMEM not caught in MMap::MMap))



Your message dated Tue, 24 Nov 2015 21:34:22 +0000
with message-id <E1a1LEE-00047b-2O@franck.debian.org>
and subject line Bug#803417: fixed in apt 1.1~exp16
has caused the Debian Bug report #803417,
regarding apt-get: Segfault upon low memory (ENOMEM not caught in MMap::MMap)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
803417: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803417
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Version: 1.0.9.8.1
Severity: normal

Dear Maintainer,

indeed the Seagate dockstar with 128 Mbyte RAM just meets the
"Minimum Hardware Requirements" as in the installation guide[1].
However it's getting quite tight and causes segmentation faults
repeatedly here, e.g. when trying to install another package.

Some more analysis revealed ENOMEM is not properly caught in the MMap
class.

According to strace:

(...)
55629 open("/var/cache/apt/pkgcache.bin", O_RDONLY|O_LARGEFILE) = 5
    This is "FileFd CacheF(CacheFile,FileFd::ReadOnly);" in
    apt-pkg/pkgcachegen.cc:1182
55629 fcntl64(5, F_SETFD, FD_CLOEXEC)   = 0
55629 fstat64(5, {st_mode=S_IFREG|0644, st_size=31003485, ...}) = 0
55629 mmap2(NULL, 31003485, PROT_READ|PROT_WRITE, MAP_PRIVATE, 5, 0) = -1 ENOMEM (Cannot allocate memory)
    Note: ENOMEM is not caught!

55629 pipe([6, 7])                      = 0
    This is "pipe(external) != 0" in apt-pkg/aptconfiguration.cc:336
55629 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb6f9d068) = 55631
(...)
55629 close(6)                          = 0
55629 munmap(0xb68d4000, 4096)          = 0
55629 wait4(55631,  <unfinished ...>
55631 +++ exited with 0 +++
55629 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 55631
55629 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=55631, si_uid=0, si_status=0, si_utime=15, si_stime=423} ---
55629 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffff} ---
55629 +++ killed by SIGSEGV +++


As far as I can see, MMap::Map in apt-pkg/contrib/mmap.cc detects
errors but this does not get through to the MMap call in 
apt-pkg/pkgcachegen.cc:1183 and that code happily continues operation.

The following quick and dirty patch confirms my analysis. Using that,
apt-get exits "Out of memory" which doesn't help much but at least
avoids potentially harmful things.

--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -114,7 +114,10 @@ bool MMap::Map(FileFd &Fd)
         SyncToFd = new FileFd (dupped_fd);
         if (!SyncToFd->Seek(0L) || !SyncToFd->Read(Base, iSize))
            return false;
-      }
+      } else if (errno == ENOMEM) {
+        std::cerr << "Out of memory!\n";
+        exit(1);
+    }
       else
         return _error->Errno("mmap",_("Couldn't make mmap of %llu bytes"),
                              iSize);

Note I can work around the low memory problem by other means. So I'm
just asking to handle ENOMEM gracefully in the future.

Regards,

    Christoph

[1] https://www.debian.org/releases/stable/armel/ch03s04.html.en

-- Package-specific info:

-- (no /etc/apt/preferences present) --

-- (/etc/apt/sources.list present, but not submitted) --

-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armel (armv5tel)

Kernel: Linux 4.1.10
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages apt depends on:
ii  debian-archive-keyring  2014.3
ii  gnupg                   1.4.18-7
ii  libapt-pkg4.12          1.0.9.8.1
ii  libc6                   2.19-18+deb8u1
ii  libgcc1                 1:4.9.2-10
ii  libstdc++6              4.9.2-10

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc                      <none>
pn  aptitude | synaptic | wajig  <none>
ii  dpkg-dev                     1.17.25
pn  python-apt                   <none>

-- Configuration Files:
/etc/logrotate.d/apt changed [not included]

-- no debconf information

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Source: apt
Source-Version: 1.1~exp16

We believe that the bug you reported is fixed in the latest version of
apt, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 803417@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Vogt <mvo@debian.org> (supplier of updated apt package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 24 Nov 2015 21:29:14 +0100
Source: apt
Binary: apt libapt-pkg5.0 libapt-inst2.0 apt-doc libapt-pkg-dev libapt-pkg-doc apt-utils apt-transport-https
Architecture: source all amd64
Version: 1.1~exp16
Distribution: experimental
Urgency: medium
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Michael Vogt <mvo@debian.org>
Description:
 apt        - commandline package manager
 apt-doc    - documentation for APT
 apt-transport-https - https download transport for APT
 apt-utils  - package management related utility programs
 libapt-inst2.0 - deb package format runtime library
 libapt-pkg-dev - development files for APT's libapt-pkg and libapt-inst
 libapt-pkg-doc - documentation for APT development
 libapt-pkg5.0 - package management runtime library
Closes: 693092 803417 804923 805069 805424 805474
Changes:
 apt (1.1~exp16) experimental; urgency=medium
 .
   [ David Kalnischkies ]
   * do not use _apt for file/copy sources if it isn't world-accessible
     (Closes: 805069)
   * support setting empty values (sanely) & removing support
     for space-gapping: '-o option= value'
     Thanks to Daniel Hartwig for initial patch. (Closes: 693092)
   * ignore lost+found in private directory cleanup (Closes: 805424)
   * update libapt-{pkg,inst} symbols files
   * do not rerun ./configure causing FTCBFS with newer autotools-dev.
     Thanks to Helmut Grohne for the detailed bugreport. (Closes: 804923)
   * do not segfault in cache generation on mmap failure (Closes: 803417)
   * do not sent Last-Modified if we expect a changed file
   * show potentially arch-qualified fullname in 'apt show'
 .
   [ Frans Spiesschaert ]
   * Dutch manpages translation (NEW) (Closes: 805474)
 .
   [ Justin B Rye ]
   * review of new/changed translatable program strings
Checksums-Sha1:
 71c8be81abcecaea005adaf2c44f8944d3fe86b3 2331 apt_1.1~exp16.dsc
 38bc48b4ee9e4e0b72034ff509d49e601477ddb9 1987944 apt_1.1~exp16.tar.xz
 83863f183b420c722b1ab77d23c30212575b8435 335618 apt-doc_1.1~exp16_all.deb
 634cffcbf2a4dc162ed72ed0bcf907e59abe5e7c 145570 apt-transport-https_1.1~exp16_amd64.deb
 ba8588b1e56a497db0254e10425af054da38896a 379844 apt-utils_1.1~exp16_amd64.deb
 f52bc9cd7628c96223c468f110332ba130e7d417 1082760 apt_1.1~exp16_amd64.deb
 abecf1715e2d9a4aed1314b788ad35fcc939b521 175608 libapt-inst2.0_1.1~exp16_amd64.deb
 1dc876355cec9a2ca6927ff698350e91272de632 213584 libapt-pkg-dev_1.1~exp16_amd64.deb
 46444fdca24a15c4f0c39bd578f9302736a43aeb 972930 libapt-pkg-doc_1.1~exp16_all.deb
 4df46876146622c556c5ab603a795e447193995a 789588 libapt-pkg5.0_1.1~exp16_amd64.deb
Checksums-Sha256:
 4fddd4bdb9605eaab48c6d3de765436393528b86d517d6197ea5d2ac9e17648e 2331 apt_1.1~exp16.dsc
 2e2d08f6f6405633505a1fdb8600a4151bda8acbdbebd809ee81d68ced045b07 1987944 apt_1.1~exp16.tar.xz
 2f5aff11a3da03f6bcf87f16067586fd36f225d7d96d09b815923a1d766e62ca 335618 apt-doc_1.1~exp16_all.deb
 a801476d588034417f79cb7f5128aae28af6f079bb339bff9bbd84c76c88a204 145570 apt-transport-https_1.1~exp16_amd64.deb
 039a99f6eaaf283da6da789ca0682ef8365d24345e27f60120b5711789e58eb0 379844 apt-utils_1.1~exp16_amd64.deb
 27a5ccd046d31e599f585f65d3cda2daa2c72e255352623091ab57064c960139 1082760 apt_1.1~exp16_amd64.deb
 2572a1621069077478e1c81af09cd1ab7fea534a26fd9f518442ca2264eb0166 175608 libapt-inst2.0_1.1~exp16_amd64.deb
 7cbd91699a8ed36e76b3aee1d394057585d41443219ede092a224613fb8073b8 213584 libapt-pkg-dev_1.1~exp16_amd64.deb
 1c0e7c344948e3504d193ff9f3a87578235829bb8e6fefc628cbf02c78b691f6 972930 libapt-pkg-doc_1.1~exp16_all.deb
 e7ac96d22c9a69eefe6fe4bb72eb6c23b2410778f3e0937f76acbd46d39a7b52 789588 libapt-pkg5.0_1.1~exp16_amd64.deb
Files:
 678b9ace24a0a69c74392e9243c6c594 2331 admin important apt_1.1~exp16.dsc
 d84c0363d76c173a40317114360f175f 1987944 admin important apt_1.1~exp16.tar.xz
 25810fac71bb5e981e80146320042b2f 335618 doc optional apt-doc_1.1~exp16_all.deb
 af560861eecd02d0cb48e141bbad2d5c 145570 admin optional apt-transport-https_1.1~exp16_amd64.deb
 f71d2b305497c4e4bd12cffc1566d214 379844 admin important apt-utils_1.1~exp16_amd64.deb
 845ddfce3edb889b823c990f96e5d7b9 1082760 admin important apt_1.1~exp16_amd64.deb
 d4015929d2d50f4b6d4955de26eac7cd 175608 libs important libapt-inst2.0_1.1~exp16_amd64.deb
 d4e2ba59e37589e076c62f00a1bc10f7 213584 libdevel optional libapt-pkg-dev_1.1~exp16_amd64.deb
 432ab82fdb31c76939411e3517e1aac7 972930 doc optional libapt-pkg-doc_1.1~exp16_all.deb
 72e51fa18fe6482a2749067634dcaf9a 789588 libs important libapt-pkg5.0_1.1~exp16_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWVMyfAAoJEJjKuzq9TKWejTUP/3fP83zhfOUeRrxm7WaQgmvU
Q7tS6ULqC3X2rQJywidGjxQe+lMFxSKw4vgFhUrH8J847CCGq20UFJUfaiPslmRM
TJSmhV36IZ6vd/kDgfINSFLWAPDi81iJFchWEM2+/BorHjhK/FPYZb0bcPebOGqb
k29SFNbUowJj4cvBNomgkoRwfGJKpWPTLpT3QW45Di5v16PRTKHp8S9B5gOeCUnh
x0e7VrF6U5Cd36P0fH+73JJ3gUUgVoczs8F7Sl8nEaK0Vjx7LNwg7XtfsG4gjSFF
oWvy6b545FIfa0yjFWMJt5g358cyidv+3Q60waxhYc90HHdfTbgg2e1AV+j2JW2G
I0EbvTInA8T2u6MZgeDvg1OQU/tVGZA5UwI+HS2AMLZ+p/9D/dBvzTNxc5CMeqw6
Z4h1w7OqolFvJLVbkHrdwHgmbRHNlNqHAQsHIqvqGw5pDk0SuyC0Zw0y1pMP1aOh
jhLp/eI7laS4xIafyS5INQ5wCT4t2HqEE0L9NAHm64hGWfqotBiVW5AccCFxoIpk
PFHrhA+6doETbDyQp4MuVsLMzIKo/hQ1mzY+S5jzWMFJsCFZpml/qr+AN1pYB6Hb
E1zT35GvCyqDvu7qEmw3SavPtd0KdU0d0+57SUqnw4/3NFY31sNs3r0VKtz9l1Pn
JiCOxRWviMuVhrwW8LNg
=1Ylp
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: