empty /proc/cpuinfo can cause segfault
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cmake (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Undecided
|
dann frazier | ||
Mantic |
Fix Released
|
Undecided
|
Unassigned | ||
Noble |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
cmake-extra's copyrighttest autopkgtest segfaults on armhf in our test infra:
https:/
This is because /proc/cpuinfo appears to be empty, which triggers an underflow condition. This doesn't impact all architectures - it may be limited to armhf containers running on arm64 hosts.
This presumably impacts the building of any software using the CopyrightTest module provided by cmake-extra in a similar environment.
[Test Case]
Launch an armhf lxd jammy container and run the autopkgtest for cmake-extras within:
ubuntu@
+ set -ep
+ mktemp --tmpdir=/tmp -d
+ builddir=
+ trap rm -rf /tmp/tmp.106fU16BhF 0 INT QUIT ABRT PIPE TERM
+ pwd
+ srcdir=
+ cd /tmp/tmp.106fU16BhF
+ cmake /home/ubuntu/
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
terminate called after throwing an instance of 'std::length_error'
what(): basic_string:
Aborted (core dumped)
+ rm -rf /tmp/tmp.106fU16BhF
ubuntu@
[What Could Go Wrong]
The upstream fix now emits an errors message when an empty /proc/cpuinfo file is found. This error message is not expected by cmake's built-in tests, causing those tests to fail. It may impact other tests as well. Though it should only be emitted in environments where cmake would otherwise crash.
This was fixed in Debian in 3.26.4-2, resolving the issue for >= mantic:
cmake (3.26.4-2) experimental; urgency=medium
* Tolerate empty /proc/cpuinfo
-- Timo Röhling <XXX> Sun, 28 May 2023 13:14:04 +0200