Docker Tooling - #855
Open
ingo-budde wants to merge 9 commits into
Open
Conversation
ingo-budde
commented
Aug 11, 2026
Member
- Analyze projects using phasar (script as driver for compiling, IR extraction and analysis invocation)
- Use docker to run the analysis
…phasar-analyze.sh script that orchestrates several steps required for program analysis.
ingo-budde
requested review from
MMory,
fabianbs96 and
janniclas
as code owners
August 11, 2026 13:47
There was a problem hiding this comment.
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-analyzewrapper 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-analyzethe 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 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 |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.