segfault in apt-esm-hook
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-advantage-tools (Ubuntu) |
Fix Released
|
Undecided
|
Chad Smith | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned | ||
Groovy |
Fix Released
|
Undecided
|
Unassigned | ||
Hirsute |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
This bug results in segfault messages interspersed within apt command output. The segfaults do not prevent apt from doing its job, but they do add noise and look concerning. Further, the user will not get the messages that uatools needs to inject into apt output. This can include important information, such as a warning that your esm contract is about to expire.
We fix this bug by adding a null-check on the Origin field of packages in the uatools apt-esm-hook. This prevents the segfault when the user has apt repos that leave the Origin field blank.
[Test Plan]
Reproduce the bug on a container by adding an apt repo that doesn't have an "Origin" specified. When running apt update or apt upgrade you will see "Segmentation fault (core dumped)" in the output. For example:
```
lxc launch ubuntu-daily:bionic test-apt-
lxc exec test-apt-
# inside the container now
wget -qO - https:/
echo "deb [arch=amd64] https:/
apt update
apt install irods-dev=4.2.2
apt update
```
At the end of the output of the last apt update command, you will see the segfault.
To see the fix in action, install the new ua version from our staging PPA. Continuing on the same container:
```
add-apt-repository ppa:ua-
apt install ubuntu-
apt update
```
There should be no segfaults anymore.
[Where problems could occur]
We're using a function called DeNull, defined in an apt header file. If a different version of apt comes out where the DeNull function is removed, or if its behavior changes, it could cause a FTBFS or for this bug to be reintroduced.
[Other Info]
We believe this is the same bug that caused uatools to be retracted from focal by the phased updates system. See that error here: https:/
If we are correct, this bugfix will eliminate those recurring errors on focal as well.
[Original Description]
This bug has been brought to my attention by a UA Canonical customer.
In this current situation, there is no attached UA subscription.
They can repeatly reproduce the error on a newly installed Bionic system
Support (STS/SEG) can't reproduce it so far. Still under testing and investigation.
# dpkg
ii ubuntu-
ii apt 1.6.13 amd64 commandline package manager
ii python3 3.6.7-1~18.04 amd64 interactive high-level object-oriented language (default python3 version)
# cat path_to_
SERVICE AVAILABLE DESCRIPTION
esm-infra yes UA Infra: Extended Security Maintenance (ESM)
fips yes NIST-certified FIPS modules
fips-updates yes Uncertified security updates to FIPS modules
livepatch yes Canonical Livepatch service
This machine is not attached to a UA subscription.
# systemd service
-* ua-messaging.
Loaded: loaded (/lib/systemd/
Active: failed (Result: exit-code) since Thu 2021-05-20 09:25:13 BST; 57min ago
Process: 54277 ExecStart=
Main PID: 54277 (code=exited, status=1/FAILURE)
May 20 09:25:13 python3[54277]: File "/usr/lib/
May 20 09:25:13 python3[54277]: util.subp(
"process-
May 20 09:25:13 python3[54277]: File "/usr/lib/
May 20 09:25:13 python3[54277]: out, err = _subp(args, rcs, capture, timeout, env=env)
May 20 09:25:13 python3[54277]: File "/usr/lib/
May 20 09:25:13 python3[54277]: stderr=
May 20 09:25:13 python3[54277]: uaclient.
May 20 09:25:13 systemd[1]: ua-messaging.
May 20 09:25:13 systemd[1]: ua-messaging.
May 20 09:25:13 systemd[1]: Failed to start Ubuntu Advantage APT and MOTD Messages.
# logs
2021-05-20 09:25:11,842 - ua_update_
2021-05-20 09:25:11,842 - util.py:(414) [DEBUG]: Reading file: /etc/os-release
2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/
2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/
2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/
2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/
2021-05-20 09:25:11,848 - util.py:(414) [DEBUG]: Reading file: /var/lib/
2021-05-20 09:25:11,848 - config.py:(357) [DEBUG]: File does not exist: /var/lib/
syslog:May 20 09:25:25 kernel: [58330.647499] apt-esm-
syslog:May 20 09:25:27 kernel: [58332.528175] apt-esm-
tags: | added: seg sts |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
According to build log, apt-esm-hook seems to be in fact apt-hook/hook.cc at src package level:
install -D -m 755 hook /<<PKGBUILDDIR> >/debian/ ubuntu- advantage- tools/usr/ lib/ubuntu- advantage/ apt-esm- hook