-
Notifications
You must be signed in to change notification settings - Fork 3
445 lines (390 loc) · 15.5 KB
/
Copy pathci.yml
File metadata and controls
445 lines (390 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
name: FrankenLibC CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
run_extended:
description: "Run extended CI gates (slow)"
required: false
default: false
type: boolean
schedule:
- cron: "0 6 * * *"
concurrency:
group: frankenlibc-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
core-gates:
name: Core Gates
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt, clippy
- name: Cache cargo and target
uses: Swatinem/rust-cache@v2
- name: Run core CI script
run: |
mkdir -p artifacts/ci
scripts/ci.sh 2>&1 | tee artifacts/ci/core-gates.log
- name: Run proptest gate (10k cases/property)
run: |
mkdir -p artifacts/ci
PROPTEST_CASES=10000 \
cargo test -p frankenlibc-core prop_ -- --nocapture \
2>&1 | tee artifacts/ci/proptest-10k.log
- name: Upload core CI artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: core-ci-artifacts
path: |
artifacts/ci/**
if-no-files-found: warn
retention-days: 14
release-builds:
name: Release Builds
needs: core-gates
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt, clippy
- name: Cache cargo and target
uses: Swatinem/rust-cache@v2
- name: Build release workspace
run: |
mkdir -p artifacts/ci
cargo build --workspace --all-targets --release 2>&1 | tee artifacts/ci/release-workspace.log
- name: Build ABI release artifact
run: |
cargo build -p frankenlibc-abi --release 2>&1 | tee artifacts/ci/release-abi.log
- name: Check replacement guard (interpose policy)
run: |
bash scripts/check_replacement_guard.sh interpose 2>&1 | tee artifacts/ci/replacement-guard-interpose.log
- name: Check release replacement-level claim evidence
run: |
bash scripts/release/check_replacement_claim_evidence.sh 2>&1 | tee artifacts/ci/release-claim-evidence.log
- name: Build standalone replacement artifact when feature exists
run: |
if grep -Eq '(^|[[:space:]])standalone([[:space:]]*=|[[:space:]])' crates/frankenlibc-abi/Cargo.toml; then
cargo build -p frankenlibc-abi --release --features=standalone 2>&1 | tee artifacts/ci/release-standalone.log
else
echo "SKIP: frankenlibc-abi standalone feature not declared in Cargo.toml" | tee artifacts/ci/release-standalone.log
fi
- name: Upload release build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: release-build-artifacts
path: |
artifacts/ci/release-*.log
artifacts/ci/replacement-guard-interpose.log
target/conformance/release_claim_evidence_gate.report.json
target/conformance/release_claim_evidence_gate.log.jsonl
target/release/libfrankenlibc_abi.so
target/conformance/replacement_guard.report.json
target/conformance/replacement_guard.log.jsonl
if-no-files-found: warn
retention-days: 14
extended-gates:
name: Extended Gates
needs: core-gates
if: >
github.event_name == 'schedule' ||
github.ref == 'refs/heads/main' ||
(github.event_name == 'workflow_dispatch' && inputs.run_extended)
runs-on: ubuntu-latest
timeout-minutes: 240
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt, clippy
- name: Cache cargo and target
uses: Swatinem/rust-cache@v2
- name: Run extended gate suite
run: |
mkdir -p artifacts/ci
FRANKENLIBC_EXTENDED_GATES=1 scripts/ci.sh 2>&1 | tee artifacts/ci/extended-gates.log
- name: Run LD_PRELOAD smoke suite
run: |
TIMEOUT_SECONDS=10 scripts/ld_preload_smoke.sh 2>&1 | tee artifacts/ci/ld-preload-smoke.log
- name: Upload extended CI artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: extended-ci-artifacts
path: |
artifacts/ci/**
target/conformance_golden/**
target/runtime_math_golden/**
target/ld_preload_smoke/**
if-no-files-found: warn
retention-days: 14
fuzz-gates:
name: Fuzz Gates
needs: core-gates
if: >
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && inputs.run_extended)
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt, clippy
- name: Cache cargo and target
uses: Swatinem/rust-cache@v2
- name: Install cargo-fuzz
run: |
cargo install cargo-fuzz --locked
- name: Run fuzz readiness gates
run: |
mkdir -p artifacts/ci
scripts/check_fuzz_harness_architecture.sh 2>&1 | tee artifacts/ci/fuzz-harness-architecture.log
scripts/check_fuzz_phase1_targets.sh 2>&1 | tee artifacts/ci/fuzz-phase1-targets.log
scripts/check_fuzz_phase2_targets.sh 2>&1 | tee artifacts/ci/fuzz-phase2-targets.log
scripts/check_fuzz_membrane_validation.sh 2>&1 | tee artifacts/ci/fuzz-membrane-validation.log
- name: List fuzz targets
run: |
cargo fuzz list --fuzz-dir crates/frankenlibc-fuzz 2>&1 | tee artifacts/ci/fuzz-target-list.log
- name: Run fuzz targets with nightly run budget
run: |
mkdir -p artifacts/ci/fuzz-runs
FUZZ_RUNS_PER_TARGET="${FUZZ_RUNS_PER_TARGET:-1000000}"
FUZZ_TIMEOUT_SECONDS="${FUZZ_TIMEOUT_SECONDS:-1800}"
targets=(
fuzz_string
fuzz_malloc
fuzz_membrane
fuzz_printf
fuzz_resolver
fuzz_resolv
fuzz_iconv
fuzz_runtime_math
)
for target in "${targets[@]}"; do
log="artifacts/ci/fuzz-runs/${target}.log"
echo "=== ${target}: -runs=${FUZZ_RUNS_PER_TARGET} ===" | tee "${log}"
if command -v timeout >/dev/null 2>&1; then
timeout "${FUZZ_TIMEOUT_SECONDS}" \
cargo fuzz run --fuzz-dir crates/frankenlibc-fuzz "${target}" -- \
-runs="${FUZZ_RUNS_PER_TARGET}" \
-print_final_stats=1 2>&1 | tee -a "${log}"
else
cargo fuzz run --fuzz-dir crates/frankenlibc-fuzz "${target}" -- \
-runs="${FUZZ_RUNS_PER_TARGET}" \
-print_final_stats=1 2>&1 | tee -a "${log}"
fi
done
- name: Build fuzz execution summary
if: always()
run: |
python3 - <<'PY'
import glob
import json
import os
import re
from pathlib import Path
run_id = os.environ.get("GITHUB_RUN_ID", "local")
root = Path("artifacts/ci/fuzz-runs")
rows = []
for path_str in sorted(glob.glob(str(root / "*.log"))):
path = Path(path_str)
text = path.read_text(encoding="utf-8", errors="replace")
target = path.stem
done = re.findall(r"Done\\s+([0-9]+)\\s+runs", text)
executed = re.findall(r"number of executed units:\\s*([0-9]+)", text)
timeout_hit = "Command exited with non-zero status 124" in text
crash_markers = [
"==ERROR: libFuzzer: deadly signal",
"ERROR: AddressSanitizer",
"artifact_prefix=",
"Test unit written to ",
]
crash_detected = any(marker in text for marker in crash_markers)
runs = 0
if done:
runs = int(done[-1])
elif executed:
runs = int(executed[-1])
rows.append(
{
"target": target,
"runs_completed": runs,
"timeout_hit": timeout_hit,
"crash_detected": crash_detected,
"log_path": str(path),
}
)
payload = {
"schema_version": "fuzz.summary.v1",
"run_id": run_id,
"targets": rows,
}
out = Path("artifacts/ci/fuzz-summary.v1.json")
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
print(f"wrote {out}")
PY
- name: Upload fuzz artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: fuzz-artifacts
path: |
artifacts/ci/fuzz-*.log
artifacts/ci/fuzz-runs/**
artifacts/ci/fuzz-summary.v1.json
crates/frankenlibc-fuzz/artifacts/**
crates/frankenlibc-fuzz/corpus/**
tests/conformance/fuzz_*.json
if-no-files-found: warn
retention-days: 14
multiarch-readiness:
name: Multi-Arch Readiness
needs: core-gates
if: >
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && inputs.run_extended)
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly with aarch64 target
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: aarch64-unknown-linux-gnu
- name: Cache cargo and target
uses: Swatinem/rust-cache@v2
- name: Multi-arch toolchain probe + build check
run: |
mkdir -p artifacts/ci
if command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
cargo check --workspace --all-targets --target aarch64-unknown-linux-gnu 2>&1 | tee artifacts/ci/multiarch-aarch64-check.log
cargo build -p frankenlibc-abi --target aarch64-unknown-linux-gnu --release 2>&1 | tee artifacts/ci/multiarch-aarch64-build.log
cargo test -p frankenlibc-core --test syscall_veneer_test --target aarch64-unknown-linux-gnu --no-run 2>&1 | tee artifacts/ci/multiarch-aarch64-syscall-veneer-build.log
else
echo "SKIP: aarch64-linux-gnu-gcc not available on runner (multi-arch checks are best-effort)." | tee artifacts/ci/multiarch-aarch64-check.log
echo "SKIP: aarch64 build requires aarch64-linux-gnu-gcc linker." | tee artifacts/ci/multiarch-aarch64-build.log
echo "SKIP: aarch64 syscall veneer test build requires aarch64-linux-gnu-gcc linker." | tee artifacts/ci/multiarch-aarch64-syscall-veneer-build.log
fi
if command -v qemu-aarch64 >/dev/null 2>&1; then
if command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then
cat > artifacts/ci/qemu_probe.c <<'C'
#include <stdio.h>
int main(void) {
puts("qemu-aarch64-probe-ok");
return 0;
}
C
aarch64-linux-gnu-gcc -O2 artifacts/ci/qemu_probe.c -o artifacts/ci/qemu_probe.aarch64
qemu-aarch64 -L /usr/aarch64-linux-gnu artifacts/ci/qemu_probe.aarch64 2>&1 | tee artifacts/ci/multiarch-qemu.log
syscall_veneer_bin="$(find target/aarch64-unknown-linux-gnu/debug/deps -maxdepth 1 -type f -perm -111 -name 'syscall_veneer_test-*' ! -name '*.d' | head -n 1)"
if [ -z "${syscall_veneer_bin}" ]; then
echo "FAIL: aarch64 syscall_veneer_test binary not found after cargo test --no-run" | tee artifacts/ci/multiarch-aarch64-syscall-veneer-qemu.log
exit 1
fi
qemu-aarch64 -L /usr/aarch64-linux-gnu "${syscall_veneer_bin}" --nocapture 2>&1 | tee artifacts/ci/multiarch-aarch64-syscall-veneer-qemu.log
else
echo "SKIP: qemu probe needs aarch64-linux-gnu-gcc" | tee artifacts/ci/multiarch-qemu.log
echo "SKIP: aarch64 syscall veneer qemu run needs aarch64-linux-gnu-gcc" | tee artifacts/ci/multiarch-aarch64-syscall-veneer-qemu.log
fi
else
echo "SKIP: qemu-aarch64 not available on runner" | tee artifacts/ci/multiarch-qemu.log
echo "SKIP: qemu-aarch64 not available on runner" | tee artifacts/ci/multiarch-aarch64-syscall-veneer-qemu.log
fi
- name: Upload multi-arch artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: multiarch-artifacts
path: |
artifacts/ci/multiarch-*.log
if-no-files-found: warn
retention-days: 14
glibc-version-matrix:
name: glibc Version Matrix
needs: core-gates
if: >
github.event_name == 'schedule' ||
github.ref == 'refs/heads/main' ||
(github.event_name == 'workflow_dispatch' && inputs.run_extended)
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- glibc: "2.31"
container: "ubuntu:20.04"
distro: "Ubuntu 20.04"
- glibc: "2.34"
container: "ubuntu:22.04"
distro: "Ubuntu 22.04 (baseline)"
- glibc: "2.38"
container: "ubuntu:24.04"
distro: "Ubuntu 24.04"
container:
image: ${{ matrix.container }}
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y git curl build-essential jq
- name: Checkout
uses: actions/checkout@v4
- name: Run glibc offset compatibility check
id: glibc_check
run: |
mkdir -p artifacts/ci/glibc-matrix
scripts/glibc_offset_check/check_glibc_offsets.sh 2>&1 | \
tee "artifacts/ci/glibc-matrix/glibc-${{ matrix.glibc }}.log"
cp target/glibc_offset_check/glibc_offset_check.json \
"artifacts/ci/glibc-matrix/glibc-${{ matrix.glibc }}.json" || true
- name: Verify glibc version matches expected
run: |
expected="${{ matrix.glibc }}"
actual=$(cat target/glibc_offset_check/glibc_offset_check.json | jq -r '.glibc_version')
major_minor=$(echo "${actual}" | cut -d. -f1,2)
echo "Container glibc: ${actual} (major.minor: ${major_minor})"
echo "Expected: ${expected}"
if [[ "${major_minor}" != "${expected}" ]]; then
echo "WARNING: Container glibc ${major_minor} differs from expected ${expected}"
fi
- name: Upload glibc matrix artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: glibc-matrix-${{ matrix.glibc }}
path: |
artifacts/ci/glibc-matrix/**
if-no-files-found: warn
retention-days: 14