Skip to content

Commit 16b8506

Browse files
committed
ci fixes
1 parent 5b03445 commit 16b8506

63 files changed

Lines changed: 2862 additions & 554 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
llvm: ["21"]
23+
llvm: ["21", "22", "23"]
2424
env:
2525
LLVM_MAJOR: ${{ matrix.llvm }}
2626
steps:
@@ -32,7 +32,7 @@ jobs:
3232

3333
- uses: actions/setup-go@v5
3434
with:
35-
go-version: stable
35+
go-version: "1.22.2"
3636

3737
- name: Install LLVM ${{ matrix.llvm }}
3838
run: |
@@ -42,7 +42,7 @@ jobs:
4242
sudo apt-get install -y "llvm-$LLVM_MAJOR-dev" "clang-$LLVM_MAJOR"
4343
4444
- name: Install gllvm
45-
run: go install github.com/SRI-CSL/gllvm/cmd/...@latest
45+
run: go install github.com/SRI-CSL/gllvm/cmd/...@v1.3.1
4646

4747
- name: Install Rust nightly + rust-src
4848
run: |
@@ -59,3 +59,21 @@ jobs:
5959
6060
- name: Build analyzer and run tests
6161
run: make test LLVM_MAJOR="$LLVM_MAJOR"
62+
63+
- name: Run detected LLVM matrix
64+
run: make matrix LLVM_MAJOR="$LLVM_MAJOR"
65+
66+
- name: Run full C and Rust CLI paths
67+
if: matrix.llvm == '23'
68+
run: |
69+
REACHABILITY_ANALYZER="$PWD/analyzer/build/reachability-analyzer" \
70+
.venv/bin/python -m pytest \
71+
driver/tests/test_cli.py::test_run_c_direct \
72+
driver/tests/test_cli.py::test_run_rust_end_to_end \
73+
driver/tests/test_cli.py::test_run_mixed_end_to_end -q
74+
75+
- name: Run reproducible static checks
76+
if: matrix.llvm == '23'
77+
run: |
78+
sudo apt-get install -y cppcheck clang-tools-23
79+
make compdb static-analysis LLVM_MAJOR="$LLVM_MAJOR"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# build artifacts
22
analyzer/build/
3+
analyzer/compile_commands.json
4+
.reachability-cache/
35
**/*.bc
46
**/*.o
57
**/target/

Changelog.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,57 @@
11
### v1.1-dev
2+
- Analyzer soundness: callback value-flow now follows every indexed store into
3+
globals, aggregates, stack objects, loads, and heap-returned objects; alias and
4+
pointer-cast chains use one cycle-safe callable resolver; callback-like operand
5+
bundles and defined personality functions contribute call-graph edges.
6+
- Indirect resolution keeps exact function types as its precise path but unions
7+
address-flow-proven type-punned targets and conservatively widens unresolved
8+
cast provenance. Address-taken declarations use the same policy and appear as
9+
reached opaque leaves in `external_declarations` without changing defined-body
10+
metrics.
11+
- New default-off `--include-process-lifecycle-roots` option adds constructors,
12+
destructors, ifunc resolvers, and a defined `LLVMFuzzerInitialize` as roots.
13+
Selected roots appear in `entries`; malformed records and unresolved explicit
14+
entries are always visible as warnings.
15+
- Confidence evidence is now entry-relative. Unreachable code can no longer
16+
raise an indirectly reached decoy from `low` to `medium` confidence.
17+
- Analyzer robustness: invalid-UTF-8 symbols are replaced safely in JSON/DOT,
18+
the LLVM debug-info option lookup is type-checked, and deterministic DOT output
19+
contains the same reachable defined-function subgraph as JSON edges.
20+
- Output destinations are file-only, collision-checked through symlinks, and
21+
validated before cleanup. JSON, lists, and optional DOT are staged beside
22+
their destinations and published transactionally; failed or concurrent runs
23+
cannot expose mixed output sets or share extraction/link intermediates.
24+
- `--clean` no longer recursively deletes project-wide `*.o`, `*.bc`, or
25+
manifests. It removes selected output files and C/C++ artifacts recorded in
26+
`.reachability-cache/owned-c-artifacts.json`, while retaining unrelated files.
27+
- An explicit `--artifact` is now a strict contract: missing, unsupported, or
28+
unextractable paths fail rather than triggering discovery. Automatic discovery
29+
has no first-eight limit and rejects equally plausible candidates with a
30+
ranked list.
31+
- Static archive expansion fails closed if any requested archive cannot be
32+
listed or fully extracted. Successful expansion work is retained for
33+
diagnostics, member names containing spaces are parsed correctly, and no
34+
complete-looking partial report is published.
35+
- gllvm builds and every `get-bc` invocation now use per-run stable symlinks to
36+
the exact checked `clang`, `clang++`, and `llvm-link`; `check-toolchain` reports
37+
those effective tools.
38+
- Rust acquisition uses Cargo metadata for workspace-root profile semantics,
39+
hierarchically merges Cargo configuration, honors `CARGO_TARGET_DIR`, filters
40+
host-only artifacts consistently, and restricts fallback collection to the
41+
current invocation. Multiple live versions and every codegen unit of the same
42+
crate are preserved instead of collapsing by crate name.
43+
- Expected subprocess, decoding, JSON, and I/O failures now become concise
44+
stage-specific CLI errors without tracebacks. Analyzer warnings are forwarded
45+
on every run, while clean runs stay quiet.
46+
- Large bitcode sets are linked in bounded batches, Cargo artifact output and
47+
non-verbose C/C++ build logs are spooled, and the analyzer writes staged JSON
48+
directly to its final parser input rather than round-tripping a second copy.
49+
- Hosted CI covers LLVM 21, 22, and 23 plus full C/Rust CLI paths and reproducible
50+
cppcheck/Clang Static Analyzer gates. Matrix discovery follows `PATH` and fails
51+
without a supported LLVM unless an explicit local skip is requested.
52+
- Development setup pins gllvm 1.3.1, pytest 9.1.1, and setuptools 80.9.0;
53+
`make compdb` generates a clangd compilation database and
54+
`make static-analysis` reproduces the analyzer checks.
255
- New `--mangling {auto,legacy,v0}` flag (default `auto`) on `reachability run`,
356
for every Rust `--lang` value: forces the analysis build's rustc
457
`-Csymbol-mangling-version` so its Rust symbols match whatever build you join
@@ -73,9 +126,6 @@
73126
- The toolchain check no longer requires `opt` on `PATH`: it was only
74127
version-probed as a redundant proxy, so `clang`/`clang++`/`llvm-link` (the
75128
actual bitcode producer/merger) now define coherence.
76-
- Rust acquisition warns when `deps/` holds bitcode from more than one build of a
77-
crate (the newest is chosen by mtime, which can be stale if that crate was
78-
cached); re-run with `--clean` for a fresh build.
79129
- C/C++ artifact detection now recognizes fat/universal Mach-O binaries.
80130

81131
### v1.0

Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ GOBIN := $(shell go env GOPATH 2>/dev/null)/bin
1616
PY := $(CURDIR)/.venv/bin/python
1717
ANALYZER := $(CURDIR)/analyzer/build/reachability-analyzer
1818

19-
.PHONY: help venv build test matrix ci clean
19+
.PHONY: help venv build test matrix ci compdb cppcheck scan-build static-analysis clean
2020

2121
help:
2222
@grep -E '^[a-z-]+:.*##' $(MAKEFILE_LIST) | sed 's/:.*##/\t/'
23+
@printf 'compdb\tgenerate analyzer/compile_commands.json for clangd\n'
24+
@printf 'cppcheck\trun cppcheck on the analyzer\n'
25+
@printf 'scan-build\trun Clang Static Analyzer on the analyzer\n'
26+
@printf 'static-analysis\trun all analyzer static checks\n'
2327

2428
venv: ## create the Python venv (.venv) with the driver + test deps
2529
bash scripts/setup_venv.sh
@@ -36,12 +40,22 @@ test: build | $(PY) ## run the full test suite
3640
REACHABILITY_ANALYZER="$(ANALYZER)" \
3741
"$(PY)" -m pytest tests/ -q
3842

39-
matrix: ## build + test against every installed llvm-config-NN (NN >= 21)
43+
matrix: | $(PY) ## build + test against every installed llvm-config-NN (NN >= 21)
4044
bash scripts/test_matrix.sh
4145

4246
ci: ## run this repo's suite + cov-analysis's suite (cross-repo key contract)
4347
bash scripts/ci_cross_repo.sh
4448

49+
compdb:
50+
$(MAKE) -C analyzer LLVM_CONFIG=$(LLVM_CONFIG) compdb
51+
52+
cppcheck:
53+
$(MAKE) -C analyzer LLVM_CONFIG=$(LLVM_CONFIG) cppcheck
54+
55+
scan-build:
56+
$(MAKE) -C analyzer LLVM_CONFIG=$(LLVM_CONFIG) scan-build
57+
58+
static-analysis: cppcheck scan-build
59+
4560
clean: ## remove analyzer build outputs
4661
$(MAKE) -C analyzer clean BUILD=build
47-
rm -rf analyzer/build/2[0-9]

0 commit comments

Comments
 (0)