Merge ~vpa1977/ubuntu/+source/atop:armfh_fail into ubuntu/+source/atop:ubuntu/devel

Proposed by Vladimir Petko
Status: Needs review
Proposed branch: ~vpa1977/ubuntu/+source/atop:armfh_fail
Merge into: ubuntu/+source/atop:ubuntu/devel
Diff against target: 75 lines (+41/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/atopacctd_return_error.patch (+31/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Dave Jones (community) Approve
git-ubuntu import Pending
Review via email: mp+452863@code.launchpad.net

Description of the change

Changes:
 - avoid sigfpe due to the truncated shadow file

When the atopacctd service crashes on startup (that is the case for armhf containers), it may leave a 0-length shadow file.
atopacctd() routine tries to read it and fails. It returns 1 (success)
and sets maxshadowrec size to the size from the 'current' file. The rest
of the code assumes that the shadow file read was successful and tries
to use an empty acct structure, causing a division by zero.

PPA: ppa:vpa1977/plusone[1]

Testing:
 - autopkgtest:
  - atop/2.9.0-1ubuntu1~ppa1
    + ✅ atop on mantic for amd64 @ 05.10.23 03:37:41 Log️ 🗒️
    + ✅ atop on mantic for arm64 @ 05.10.23 03:36:38 Log️ 🗒️
    + ✅ atop on mantic for armhf @ 05.10.23 03:36:10 Log️ 🗒️
    + ✅ atop on mantic for ppc64el @ 05.10.23 03:33:14 Log️ 🗒️
    + ✅ atop on mantic for s390x @ 05.10.23 03:32:36 Log️ 🗒️
 - piuparts test[2]
1m39.4s INFO: PASS: All tests.
1m39.4s INFO: piuparts run ends.

[1]https://launchpad.net/~vpa1977/+archive/ubuntu/plusone
[2] https://bugs.launchpad.net/ubuntu/+source/atop/+bug/2037910/+attachment/5707008/+files/atop.log.gz

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is the upstream commit now:

https://github.com/Atoptool/atop/commit/f72f7c06278ec9ad2209975eca67c2e3c0b3a44b

They closed the bug[1], but not your PR[2].

This is ready for sponsoring after you update this PR.

1. https://github.com/Atoptool/atop/issues/277
2. https://github.com/Atoptool/atop/pull/278

eee01b9... by Vladimir Petko

  * d/p/atopacctd_return_error.patch: apply upstream patch to fix SIGFPE in acctprocnt()

62f931a... by Vladimir Petko

changelog: upstream patch

Revision history for this message
Vladimir Petko (vpa1977) wrote :

Thank you!

I've updated the branch, not sure if I should rebase it (this will invalidate comments)

Revision history for this message
Vladimir Petko (vpa1977) wrote :

Autopkgtest passes with the upstream patch:
  - atop/2.9.0-1ubuntu1~ppa2
    + ✅ atop on mantic for armhf @ 08.10.23 19:36:00 Log️ 🗒️

Revision history for this message
Dave Jones (waveform) wrote :

No need to rebase; all looks good now, so I'll sponsor to the archive.

review: Approve

Unmerged commits

62f931a... by Vladimir Petko

changelog: upstream patch

eee01b9... by Vladimir Petko

  * d/p/atopacctd_return_error.patch: apply upstream patch to fix SIGFPE in acctprocnt()

54a0687... by Vladimir Petko

changelog

ca59aed... by Vladimir Petko

control

0e0c7ec... by Vladimir Petko

  * d/p/atopacctd_return_error.patch: fix SIGFPE in acctprocnt() (LP: #1725896, LP: #2037910).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 9af1540..44fbd6a 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+atop (2.9.0-1ubuntu1) mantic; urgency=medium
7+
8+ * d/p/atopacctd_return_error.patch: apply upstream patch to fix SIGFPE in
9+ acctprocnt() (LP: #1725896, LP: #2037910).
10+
11+ -- Vladimir Petko <vladimir.petko@canonical.com> Thu, 05 Oct 2023 15:25:12 +1300
12+
13 atop (2.9.0-1) unstable; urgency=medium
14
15 * new upstream version 2.9.0
16diff --git a/debian/control b/debian/control
17index bf0a9a8..4a5f639 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,7 +1,8 @@
21 Source: atop
22 Section: admin
23 Priority: optional
24-Maintainer: Marc Haber <atop@packages.debian.org>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Marc Haber <atop@packages.debian.org>
27 Uploaders: Marc Haber <mh+debian-packages@zugschlus.de>
28 Build-Depends: debhelper-compat (= 13), zlib1g-dev, libncurses-dev
29 Standards-Version: 4.6.2
30diff --git a/debian/patches/atopacctd_return_error.patch b/debian/patches/atopacctd_return_error.patch
31new file mode 100644
32index 0000000..cca0cec
33--- /dev/null
34+++ b/debian/patches/atopacctd_return_error.patch
35@@ -0,0 +1,31 @@
36+Description: Avoid floating point exception when atopacctd fails
37+ When the atopacctd service crashes, it may leave a 0-length shadow file.
38+ atopacctd() routine tries to read it and fails. It returns 1 (success)
39+ and sets maxshadowrec size to the size from the 'current' file. The rest
40+ of the code assumes that the shadow file read was successful and tries
41+ to use an empty acct structure, causing a division by zero.
42+Author: Gerlof Langeveld <gerlof.langeveld@atoptool.nl>
43+Bug: https://github.com/Atoptool/atop/issues/277
44+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/atop/+bug/2037910
45+Applied-Upstream: https://github.com/Atoptool/atop/commit/f72f7c06278ec9ad2209975eca67c2e3c0b3a44b
46+Last-Update: 2023-10-08
47+--- a/acctproc.c
48++++ b/acctproc.c
49+@@ -430,7 +430,6 @@ atopacctd(int swon)
50+ {
51+ if ( swon && !acctvers(acctfd) )
52+ {
53+-
54+ int maxcnt = 40;
55+
56+ if ( fork() == 0 )
57+@@ -453,7 +452,8 @@ atopacctd(int swon)
58+ &semunlock, 1);
59+
60+ regainrootprivs();
61+- return 1;
62++ maxshadowrec = 0;
63++ return -1; // try other
64+ }
65+ }
66+
67diff --git a/debian/patches/series b/debian/patches/series
68index 2ab4777..24eee56 100644
69--- a/debian/patches/series
70+++ b/debian/patches/series
71@@ -15,3 +15,4 @@ atop-pm
72 no-atopgpud
73 handle-default-file
74 default
75+atopacctd_return_error.patch

Subscribers

People subscribed via source and target branches