Skip to content

Docker Tooling - #855

Open
ingo-budde wants to merge 9 commits into
secure-software-engineering:developmentfrom
ingo-budde:f-DockerTooling
Open

Docker Tooling#855
ingo-budde wants to merge 9 commits into
secure-software-engineering:developmentfrom
ingo-budde:f-DockerTooling

Conversation

@ingo-budde

Copy link
Copy Markdown
Member
  • Analyze projects using phasar (script as driver for compiling, IR extraction and analysis invocation)
  • Use docker to run the analysis

Copilot AI lite review requested due to automatic review settings August 11, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end Docker tooling for PhASAR whole-program analysis by introducing a container entrypoint wrapper (phasar-analyze) that can build C/C++ projects to whole-program LLVM IR (via WLLVM), extract bitcode, and invoke phasar-cli, plus accompanying documentation and runnable examples.

Changes:

  • Add phasar-analyze wrapper script to build/extract whole-program LLVM IR and run PhASAR analyses in one command.
  • Update the Docker image to install the required LLVM/WLLVM toolchain and make phasar-analyze the container entrypoint.
  • Add Docker usage documentation and a suite of small whole-program example targets/configs.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Dockerfile Parameterizes LLVM version, installs LLVM/WLLVM, sets phasar-analyze as ENTRYPOINT.
utils/phasar-analyze.sh New wrapper to build/extract whole-program IR (WLLVM) and run phasar-cli.
USAGE.docker.md New end-user guide for building and using the Docker image + wrapper.
examples/docker-whole-program/README.md Documents the example suite and how to run it.
examples/docker-whole-program/run-all.sh Runs all examples through the Docker image.
examples/docker-whole-program/01-uninitialized-variables/main.c Example target for uninitialized-variable analysis.
examples/docker-whole-program/01-uninitialized-variables/util.c Companion TU to force whole-program linking + uninit bug.
examples/docker-whole-program/01-uninitialized-variables/util.h Header for the uninit example.
examples/docker-whole-program/02-linear-constant/main.c Example target for linear constant propagation.
examples/docker-whole-program/03-taint-leak/main.c Example target for taint leak (source → sink).
examples/docker-whole-program/03-taint-leak/taint-config.json Taint config for the taint leak example.
examples/docker-whole-program/04-double-free/main.c Example target for double-free taint.
examples/docker-whole-program/04-double-free/double-free-config.json Taint config for the double-free example.
examples/docker-whole-program/05-file-io-typestate/main.c Example target for libc file-I/O typestate.
examples/docker-whole-program/06-type-hierarchy/main.cpp Example target for type-hierarchy reconstruction.
examples/docker-whole-program/07-call-graph/main.cpp Example target for virtual dispatch call-graph emission.
examples/docker-whole-program/08-points-to/main.c Example target for points-to/alias emission.
examples/docker-whole-program/09-instruction-interaction/main.c Example target for instruction-interaction analysis.
examples/docker-whole-program/10-statistics/main.c Example target for module statistics emission.
examples/docker-whole-program/11-library/CMakeLists.txt Library-only example build (no main).
examples/docker-whole-program/11-library/mylib.c Library-only example target analyzed with -E __ALL__.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Dockerfile
Comment on lines 19 to +23
RUN --mount=type=bind,source=./utils/InstallAptDependencies.sh,target=/InstallAptDependencies.sh \
set -eux; \
./InstallAptDependencies.sh --noninteractive tzdata clang-20 libclang-rt-20-dev clang-tools-20
./InstallAptDependencies.sh --noninteractive --llvm-version "${llvm_version}" \
tzdata "clang-tools-${llvm_version}" "llvm-${llvm_version}" "lld-${llvm_version}" python3-pip file; \
pip3 install --no-cache-dir --break-system-packages wllvm
Comment thread utils/phasar-analyze.sh
MODULE=""
BINARY="" # artifact to extract bitcode from (autodetected if empty)
KEEP_GOING="false"
WORKDIR="${PHASAR_WORKDIR:-/tmp/phasar-analyze}"
Comment on lines +22 to +46
"01-uninitialized-variables|IFDS: use of uninitialized variables (whole-program, 2 files)|--sources 'main.c util.c' -a ifds-uninit"
"02-linear-constant|IDE: linear constant propagation|--sources main.c -a ide-lca"
"03-taint-leak|IDE: taint analysis, source->sink leak (custom config)|--sources main.c -a ide-xtaint --analysis-config taint-config.json"
"04-double-free|IFDS: double-free via taint (free = source & sink)|--sources main.c -a ifds-taint --analysis-config double-free-config.json"
"05-file-io-typestate|IDE: libc file-I/O typestate (use-after-close)|--sources main.c -a ide-stdio-ts"
"06-type-hierarchy|Type hierarchy + vtables from C++ (emit)|--sources main.cpp -- --emit-th-as-text"
"07-call-graph|Call graph incl. virtual dispatch, CHA (emit)|--sources main.cpp -C cha -- --emit-cg-as-dot"
"08-points-to|Alias/points-to information, CFLAnders (emit)|--sources main.c -- --emit-pta-as-text"
"09-instruction-interaction|IDE: which instructions influence which|--sources main.c -a ide-iia"
"10-statistics|LLVM IR statistics of the module (emit)|--sources main.c -- --emit-stats"
"11-library|Analyze a static library (no main) with all functions as entry points|--project /work -a ifds-uninit -E __ALL__"
)

for entry in "${EXAMPLES[@]}"; do
IFS='|' read -r dir desc args <<< "$entry"
echo "############################################################"
echo "# $dir"
echo "# $desc"
echo "# phasar-analyze $args"
echo "############################################################"
# `eval` so the quoted 'main.c util.c' in args is word-split correctly
eval docker run --rm "${USER_ARGS[@]}" \
-v "\"$HERE/$dir:/work\"" -w /work "\"$IMAGE\"" "$args"
echo
done
@fabianbs96 fabianbs96 added enhancement New feature or request tooling labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants