Skip to content

Commit e7b1180

Browse files
committed
docker: add what's needed for static seccomp analysis
Add the rust-src component and the $(uname -m)-unknown-linux-musl targets for the nightly toolchain, and install python3-seccomp and rustfilt. Since the python bindings for libseccomp are not published to pip, we have to install it into the global python installation via apt-get, and then copy into our venv. Signed-off-by: Patrick Roy <[email protected]>
1 parent f064dfd commit e7b1180

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/devctr/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ RUN apt-get update \
7676
tzdata \
7777
tini \
7878
squashfs-tools zstd \
79+
python3-seccomp \
7980
# for aws-lc-rs
8081
cmake \
8182
# for Qemu vhost-user-blk backend
@@ -98,8 +99,13 @@ RUN cd /tmp/poetry \
9899
ENV VIRTUAL_ENV=$VENV
99100
ENV PATH=$VENV/bin:$PATH
100101

102+
# apt-get installs it globally, to manually copy it into the venv
103+
RUN cp /usr/lib/python3/dist-packages/seccomp.cpython-312-"$ARCH"-linux-gnu.so "$VENV"/lib/python3.12/site-packages/
104+
101105
# Running the three as a single dockerfile command to avoid inflation of the image:
102-
# - Install the Rust toolchain. Kani only work on x86, so only try to install it there
106+
# - Install the Rust toolchain.
107+
# - Kani always installs _some_ nightly toolchain, we reuse it for the seccomp filter analysis test. Dynamically
108+
# determine the exact toolchain name, and install more components into it.
103109
# - Build and install crosvm (used as vhost-user-blk backend)
104110
# - Clean up cargo compilation directories
105111
# - Always install both x86_64 and aarch64 musl targets, as our rust-toolchain.toml would force on-the-fly installation of both anyway
@@ -110,6 +116,10 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-too
110116
&& cargo install --locked cargo-audit [email protected] grcov cargo-sort cargo-afl \
111117
&& cargo install --locked kani-verifier && cargo kani setup \
112118
\
119+
&& NIGHTLY_TOOLCHAIN=$(rustup toolchain list | grep nightly | tr -d '\n') \
120+
&& rustup component add rust-src --toolchain "$NIGHTLY_TOOLCHAIN" \
121+
&& rustup target add "$ARCH"-unknown-linux-musl --toolchain "$NIGHTLY_TOOLCHAIN" \
122+
\
113123
&& apt-get update \
114124
&& apt-get -y install --no-install-recommends \
115125
libcap-dev \

0 commit comments

Comments
 (0)