Skip to content

eBPF-based security platform

ci: install the headers the CBMC proofs include

Daniel Borkmann64029661bc4b
diff --git a/.agents/skills/proofs/SKILL.md b/.agents/skills/proofs/SKILL.md
index 16bb54ca..9fdafeb9 100644
--- a/.agents/skills/proofs/SKILL.md
+++ b/.agents/skills/proofs/SKILL.md
@@ -45,7 +45,8 @@ fails in CI prints its whole output, trace included, in its shard's
job log and leaves it in the `cbmc-logs-<k>` artifact. `proofs.sh`
pins CBMC 5.95.1 and elan, and Lean is the release `lean-toolchain`
names; `proofs.sh install-cbmc` unpacks the same CBMC into `build/cbmc`
-without root.
+without root, and `proofs.sh install-headers` installs with `sudo` on
+Ubuntu the headers of libcurl, OpenSSL and zlib the harnesses include.
## Write
diff --git a/.github/scripts/proofs.sh b/.github/scripts/proofs.sh
index 134071b7..7de24e1e 100755
--- a/.github/scripts/proofs.sh
+++ b/.github/scripts/proofs.sh
@@ -3,11 +3,12 @@
# Copyright (c) 2026 Authors of shirudo
#
# .github/scripts/proofs.sh -- install the pinned CBMC into build/cbmc or
-# elan and Lean into ELAN_HOME, without root, and list or run the CBMC
+# elan and Lean into ELAN_HOME, without root, or with sudo on Ubuntu the
+# library headers the CBMC harnesses include, and list or run the CBMC
# proofs of shard <k> of <n>: every <n>th of proofs.list from the <k>th,
# but those ci-skip.list names, each alone under a memory and time cap.
#
-# .github/scripts/proofs.sh install-cbmc|install-lean
+# .github/scripts/proofs.sh install-cbmc|install-headers|install-lean
# .github/scripts/proofs.sh list|run <k> <n>
set -eu
@@ -72,6 +73,19 @@ install_cbmc() {
add_path "$dir/usr/bin"
}
+# CBMC preprocesses a harness with the host's gcc, which takes the
+# headers of the C library, OpenSSL, libcurl and zlib from the system.
+# The runner image lacks libcurl's; the others are named too, so that the
+# job does not rely on what the image happens to ship.
+install_headers() {
+ sudo=
+ [ "$(id -u)" -eq 0 ] || sudo=sudo
+ $sudo apt-get update
+ $sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ --no-install-recommends libc6-dev libcurl4-openssl-dev \
+ libssl-dev linux-libc-dev zlib1g-dev
+}
+
install_lean() {
check_arch
home=${ELAN_HOME:-$HOME/.elan}
@@ -175,8 +189,9 @@ run() {
case ${1:-} in
install-cbmc) install_cbmc ;;
+install-headers) install_headers ;;
install-lean) install_lean ;;
list) shard "${2:-}" "${3:-}" ;;
run) run "${2:-}" "${3:-}" ;;
-*) die "usage: proofs.sh install-cbmc|install-lean|list|run <k> <n>" ;;
+*) die "usage: proofs.sh install-cbmc|install-headers|install-lean|list|run <k> <n>" ;;
esac
diff --git a/.github/workflows/proofs.yml b/.github/workflows/proofs.yml
index 4626ba48..e8acca36 100644
--- a/.github/workflows/proofs.yml
+++ b/.github/workflows/proofs.yml
@@ -24,9 +24,10 @@ jobs:
# Shard <k> of <n> runs every <n>th proof of proofs.list from the
# <k>th, but those ci-skip.list names, one at a time: the runner's
# 16 GB is for one proof, not four. proofs.sh caps each proof's memory
- # and time well within the job's. CBMC reads the C library's headers
- # through the runner's gcc, so the job runs on the Ubuntu release the
- # proofs are developed on, not the one ubuntu-latest moves to next.
+ # and time well within the job's. CBMC reads the headers of the C
+ # library and of the libraries the harnesses include through the
+ # runner's gcc, so the job runs on the Ubuntu release the proofs are
+ # developed on, not the one ubuntu-latest moves to next.
cbmc:
name: CBMC
runs-on: ubuntu-24.04
@@ -45,6 +46,9 @@ jobs:
- name: Install CBMC
run: .github/scripts/proofs.sh install-cbmc
+ - name: Install the headers the proofs include
+ run: .github/scripts/proofs.sh install-headers
+
- name: Run the CBMC proofs of shard ${{ matrix.shard }}
run: .github/scripts/proofs.sh run ${{ matrix.shard }} ${{ strategy.job-total }}
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index 000e360c..87e3a87b 100644
--- a/Documentation/contribute/code/developer-guide.rst
+++ b/Documentation/contribute/code/developer-guide.rst
@@ -548,12 +548,14 @@ the commit at ``HEAD`` alone without them.
only host test dependencies. The arm64 job uses this to run unit,
``ci-checks`` and host functional tests without target VMs.
Meant for CI runners, which are discarded afterwards.
- * - ``proofs.sh install-cbmc|install-lean``,
+ * - ``proofs.sh install-cbmc|install-headers|install-lean``,
``proofs.sh list|run <k> <n>``
- Installs the CBMC and the elan CI pins, each verified by its
SHA-256, and Lean, all without root: CBMC into ``build/cbmc``,
elan and the toolchain ``lean-toolchain`` names into
- ``ELAN_HOME``. Prints the directory to put on ``PATH``. ``run``
+ ``ELAN_HOME``. Prints the directory to put on ``PATH``.
+ ``install-headers`` installs with ``sudo`` on Ubuntu the headers
+ of the libraries the CBMC harnesses include. ``run``
runs the CBMC proofs of shard ``<k>`` of ``<n>`` as the ``CBMC``
jobs of the ``Proofs`` workflow do, each alone under a memory and
time cap, and ``list`` prints them. See
diff --git a/Documentation/contribute/testing/proofs.rst b/Documentation/contribute/testing/proofs.rst
index 65b2d533..72d20e44 100644
--- a/Documentation/contribute/testing/proofs.rst
+++ b/Documentation/contribute/testing/proofs.rst
@@ -105,7 +105,9 @@ a change is the only one it gets before it lands. Its ``Lean4`` job runs
of :src:`testing/proofs/cbmc/proofs.list` from the ``<k>``-th and runs
each alone, under a cap of 14 GB and 60 minutes, so a proof you add has
to fit both on a runner. CI pins CBMC 5.95.1 and elan in
-:src:`.github/scripts/proofs.sh`.
+:src:`.github/scripts/proofs.sh`, and installs the headers of libcurl,
+OpenSSL and zlib that the harnesses include with its
+``install-headers``, which a host that builds shirudo already has.
1. Install the same CBMC into ``build/cbmc``, without root, and put it
on your ``PATH``: