Skip to content

Aggregated RISCV64 + CI work #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 206 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
1ba08a7
apply autopep8 E1,W1,W2
mbrcknl Mar 18, 2021
e21ab29
trivial: Use tab for indents in graph-refine.py
yyshen Jan 8, 2020
6242ab0
A checkpoint for adding 64-bit support
yyshen Jan 24, 2020
ba21539
A checkpoint for adding 64-bit support
yyshen Jan 24, 2020
4d45f05
A checkpoint for adding 64-bit support
yyshen Jan 25, 2020
d9b35dc
A checkpoint for adding 64-bit support
yyshen Jan 26, 2020
138f4d0
A checkpoint for adding 64-bit support
yyshen Jan 30, 2020
e97f1dc
trivial: Use tab for indents in chronos parser
yyshen Jan 8, 2020
2189f25
Add arch option as input parameter
yyshen Jan 8, 2020
fa693ec
Start a parser for RISC-V
yyshen Jan 8, 2020
5843527
A checkpoint for RISCV Chronos
yyshen Jan 9, 2020
04afb61
A checkpoint
yyshen Jan 9, 2020
3628145
A checkpoint
yyshen Jan 9, 2020
473606f
A checkpoint
yyshen Jan 9, 2020
23a2ad9
A checkpoint
yyshen Jan 10, 2020
2f00247
A checkpoint
yyshen Jan 11, 2020
5c1efc4
Add arch option to elf_parser.py
yyshen Jan 11, 2020
836cfda
Set the bench_arch early
yyshen Jan 12, 2020
3881941
Add rv64 elf match string and debug info
yyshen Jan 12, 2020
4034401
A checkpoint for rv64 parser
yyshen Jan 12, 2020
27d7bd8
Add rv64 emitter
yyshen Jan 12, 2020
6edf034
Add missing import
yyshen Jan 24, 2020
1b4325b
Add more instruction handling
yyshen Jan 24, 2020
500bd02
Add test directory for RISCV64
yyshen Jan 27, 2020
7025bd0
UPdate test files
yyshen Jan 30, 2020
aa895a7
A checkpoint for testing code
yyshen Jan 31, 2020
0ec69b5
Add more optimisation levels
yyshen Feb 7, 2020
a19acb8
Change test code
yyshen Feb 7, 2020
61d977f
Copy kernelO1.elf as kernel.elf
yyshen Feb 11, 2020
08c17b0
Add test directory for Armv7
yyshen Feb 11, 2020
03ebc9a
Update Armv7 test code
yyshen Feb 13, 2020
e591e16
A checkpoint
yyshen Feb 14, 2020
2d1e659
Comment out debug messages
yyshen Feb 15, 2020
dcc7327
Tweaks for RV64 kernel
yyshen Feb 17, 2020
7bf7502
Support for rv64 assembly instructions
yyshen Feb 17, 2020
943239d
Support RODATA for rv64
yyshen Feb 18, 2020
bfd79f7
Enable loading rodata
yyshen Feb 18, 2020
9aed8ed
Fix sfence.vma
yyshen Feb 19, 2020
5f6097a
Add inline assembly hack and debug
yyshen Feb 24, 2020
45b0153
Enable cache and correct offset for RV64
yyshen Feb 24, 2020
c541a99
Add script to check the branch addesses
yyshen Feb 25, 2020
4dc184e
check_addr.py: output addresses with upper-case hex digits
mbrcknl Feb 26, 2020
2620c67
A hack to avoid recomputing stack bounds
yyshen Feb 26, 2020
6a8650a
Revert a hack
yyshen Feb 26, 2020
8a7087e
Add/remove debug messages
yyshen Feb 26, 2020
db1c578
Remove debug messages
yyshen Feb 26, 2020
b176029
Use spaces for indent
yyshen Feb 27, 2020
2da0e12
Tabs are replaced with spaces
yyshen Mar 11, 2020
d7d27e3
Fix ecall
yyshen Mar 11, 2020
94b8ffb
Add sbadaddr (the old name for stval) and ebreak
yyshen Apr 16, 2020
730b6c6
restore the assertion
yyshen Apr 16, 2020
e1df713
add mk_word16
yyshen Apr 16, 2020
13f5316
Import word16T
yyshen Apr 16, 2020
05232de
Add debug messages
yyshen Apr 16, 2020
6bd9760
Remove debug message
yyshen Apr 17, 2020
830fb01
Format preamble
yyshen Apr 17, 2020
d46ab40
Add debug message
yyshen Apr 17, 2020
4c70cff
Add debug message
yyshen Apr 17, 2020
834892f
Fix load-rodata for rv64
yyshen Apr 17, 2020
d54b62c
Add debug messages
yyshen Apr 17, 2020
d137a08
Adjust mod and change 32T to 64T
yyshen Apr 17, 2020
58ce7d3
Add r2 (stack pointer) to callee-saved list
yyshen Apr 17, 2020
21e8745
StackBounds hack for rv64
yyshen Apr 17, 2020
4a1f6b1
word64T -> syntax.word64T
yyshen Apr 17, 2020
bf43178
Add printouts for understanding the code
yyshen Apr 17, 2020
a1e97a7
Copy SMT file with a relative directory
yyshen Apr 17, 2020
841c30c
Hack to use the Slow solver
yyshen Apr 17, 2020
a1fa1d1
Support for rodata in the SMT file
yyshen Apr 17, 2020
98831f8
Add printouts to understand the code
yyshen Apr 17, 2020
93387b4
Implement -include-only argument
Apr 17, 2020
5189d29
r0 is always 0. writes to r0 do not have effects
yyshen Apr 17, 2020
9506c9d
ret_addr_input is r10 for rv64
yyshen Apr 18, 2020
ede0f44
import syntax in solver.py
MitchellBuckley Apr 20, 2020
0342d32
hard-code flags in syntax.py for RISCV64
MitchellBuckley Apr 20, 2020
818f5b3
Add smt2 for copied SMT files
yyshen Apr 22, 2020
cdb5790
Fix missing len in logic.py
Apr 22, 2020
a206c2e
create logs directory
mbrcknl Apr 24, 2020
74b9955
add script to patch ret_addr_input arguments only
mbrcknl Apr 24, 2020
b116038
Move check_addr.py to tools directory
yyshen Apr 24, 2020
1782c1b
x10 and x11 can be used to return a 128-bit value
yyshen Apr 24, 2020
0b46f32
Add preliminary support for csrw_sie and csrr_sie instructions
Apr 25, 2020
aa5b5cb
Comment out debug code
yyshen Apr 26, 2020
35fecd9
x10 and x11 can be used to return a 128-bit value
yyshen Apr 26, 2020
d307699
Implement exit on any exception in syscall argument
Apr 28, 2020
7a190e3
Add preconditions for r10 for large return values
yyshen Apr 28, 2020
9538a25
Increase recursion limit to 5000
yyshen Apr 30, 2020
809539b
Add 'r14' as an input register
yyshen May 5, 2020
c1d44be
a script to select functions by simple criteria
mbrcknl May 5, 2020
c2cb874
Add make_solverlist.sh.
MitchellBuckley May 6, 2020
da94187
Fix the sfence.vma inconsistency.
yyshen May 7, 2020
25cf9a6
Add more CSR instructions
yyshen May 12, 2020
e12cdfc
Add "csrc sstatus"
yyshen May 22, 2020
12bd7bc
64-bit support for add_pvaild_dom_assertions
yyshen Jun 2, 2020
27e41be
64-bit support for loop analysis
yyshen Jun 2, 2020
126ac01
64-bit for array size limit
yyshen Jun 2, 2020
b8b75f8
Add r10_input as post eq when ret > 1
yyshen Jun 22, 2020
458b25b
Refactor logging and argument parsing
Jun 22, 2020
99ed8e6
Implement report versioning
Jun 22, 2020
298d887
Added excludes.txt
MitchellBuckley Jun 30, 2020
e0292bf
Move 6 functions from excludes.txt to includes.txt
MitchellBuckley Jun 30, 2020
4d0223f
Move excludes.txt so that it sits with includes.txt.
MitchellBuckley Jun 30, 2020
88f44b7
add a script for generating stack bounds
mbrcknl Jun 19, 2020
deb9c17
add missing argument to problem.check_no_symbols
mbrcknl Jul 7, 2020
6b3e97c
Remove outdated check_addr.py scripts
Jul 9, 2020
d73988b
Add submit_report
Jul 9, 2020
e1e3153
avoid recomputing stack bounds
mbrcknl Jul 10, 2020
783edb9
simplify stack_bounds
mbrcknl Aug 11, 2020
2a4610d
target-2020-08-10-MCS-jr-fix: find functions with jr
mbrcknl Aug 11, 2020
342879a
riscv: fix ecall instruction spec
mbrcknl Aug 17, 2020
5636f66
fix riscv64 rodata loader
mbrcknl Aug 27, 2020
7978ee9
riscv: add sc.w instruction spec
mbrcknl Sep 21, 2020
a6ada8c
objdump: fix rodata trace messages
mbrcknl Sep 26, 2020
b2803a7
riscv: require that gp and tp registers are preserved
mbrcknl Oct 8, 2020
a6c2d4f
riscv: consolidate some debug tracing
mbrcknl Oct 7, 2020
52f8595
riscv fixup: require that gp and tp registers are preserved
mbrcknl Oct 16, 2020
64a5d0f
riscv: handle 32-bit values in 64-bit registers
mbrcknl Oct 16, 2020
0469824
word64: Implement 8-bit config mode for RISC-V
Nov 3, 2020
abd9008
word64: Remove hard-coded architecture variables
Nov 3, 2020
fbcb901
word64: create Arch class
Nov 3, 2020
6c7b169
word64: Refactor ghost_assertion_type into Arch
Nov 3, 2020
9f1f9c9
word64: make logic.py architecture-agnostic
Nov 3, 2020
6bb811f
word64: refactor architecture dispatch in stack_logic.py
Nov 4, 2020
2e6f5a3
word64: fix offs_expr_cons default type issue
Nov 4, 2020
d10217b
word64: make mk_cast part of the architecture specification
Nov 5, 2020
03e2ed3
word64: remove unused mk_fun_eqs from logic.py
Nov 5, 2020
da6089c
word64: Implement architecture-agnostic mk_eqs
Nov 5, 2020
2703671
word64: make solver.py architecture-agnostic (excl. preambles and rod…
Nov 5, 2020
f4c70fb
word64: make rodata handling architecture-agnostic
Nov 5, 2020
b3c7ca6
word64: Move Arch section to end of syntax.py (logical dependency order)
Nov 5, 2020
a0adf88
word64: make search.py architecture-agnostic
Nov 5, 2020
03dda0c
word64: make check.py architecture-agnostic
Nov 5, 2020
f99996f
word64: refactor mem_mode dispatch
Nov 5, 2020
63c720e
word64: remove majority of rv64-specific hacks
Nov 5, 2020
f6351a6
word64: partially implement rv64_native prelude
Nov 12, 2020
597065a
word64: implement rv64_native prelude
Nov 12, 2020
313ce24
word64: fix cancelAllIPCs regression
Nov 20, 2020
9ea9ca6
word64: sanitize import mechanism
Nov 20, 2020
e9d9b12
word64: make parts of syntax.py architecture-agnostic
Nov 26, 2020
b9e83d9
word64: remove print statements from solver.py
Nov 26, 2020
9803743
word64: future-proof zero-wired register check
Nov 29, 2020
c7b9d0b
word64: Implement native word16 loads in rv64 SMT prelude
Dec 1, 2020
feb749d
word64: optimize word16-shift implementation
Dec 1, 2020
a1a0840
word64: make stack_logic.py architecture-agnostic
Dec 2, 2020
8c90963
word64: make cast_pair arch-specific, restore orig. mk_cast behavior
Dec 2, 2020
9b8eee4
word64: remove outdated comments about rodata_chunk_type
Dec 3, 2020
e7f8713
word64: remove hack paving over a long-since-fixed decompiler bug
Dec 3, 2020
74d8e0b
word64: restore uniform token_smt_typ across architectures
Dec 3, 2020
1b7c1a6
word64: remove redundant conditional in logic.py
Dec 3, 2020
62e0ce9
riscv: add rdcycle instruction spec
mbrcknl Dec 7, 2020
8cbf2cf
riscv: add `load-word32` and `store-word32` to SMT preamble
mbrcknl Dec 8, 2020
45c9bca
solverlist configuration format updates
mbrcknl Jan 11, 2021
eb93c14
riscv: remove redundant debug trace
mbrcknl Jan 12, 2021
18f243a
Remove orphan print statements from solver.py and inst_logic.py
Jan 12, 2021
3ab7cb6
Turn off destructive printing of output in solver.py
Jan 12, 2021
b293392
riscv: remove redundant `context_trace` calls
mbrcknl Jan 12, 2021
5c0db72
add solverlist `offline-solver` configuration option
mbrcknl Jan 13, 2021
573b413
Use hash instead of random temp file names
Jan 14, 2021
3fe399c
Add filenames to non-parallel outputs
Jan 14, 2021
4903149
Remove slow_solver_multisat
Jan 14, 2021
ebd549e
Add filenames to parallel output
Jan 14, 2021
83b6e08
Make exec_slow_solver writes atomic
Jan 14, 2021
c20f101
Remove saving of SMT examples
Jan 15, 2021
c1d5a77
Refactor write_solv_script
Jan 15, 2021
53df601
remove some unused default arguments
mbrcknl Jan 14, 2021
dab9413
Add invariant check to `VisitCount`
Jan 19, 2021
4b283b0
Implement `__cmp__` for `VisitCount`
Jan 19, 2021
c8f17a8
Ensure group keys in proof_check_groups have deterministic order
Jan 20, 2021
5007946
riscv: remove some unused default arguments
mbrcknl Jan 20, 2021
6afde59
Remove dead code from solver.py
Jan 21, 2021
61d06c3
Improve error message on SMT conversation problems
Jan 21, 2021
c575be0
remove reference to undeclared variable
mbrcknl Feb 11, 2021
1f8ac82
Update Makefile to be in line w/ master
Feb 24, 2021
5d1c2a0
Update seL4 target Makefile (cleanup, automate manual fix-ups)
Mar 3, 2021
125b161
Implement new parallel solver (ParallelTaskManager)
Mar 22, 2021
5169d2f
Fix comment typos in parallel_solver.py
Mar 25, 2021
2ff9fd2
Improve log messages in parallel_solver.py
Mar 25, 2021
03621f3
Fix docstring arg list naming in parallel_solver.py
Mar 25, 2021
7cbca4e
Remove legacy (unused) classes from parallel task manager
Mar 25, 2021
be48977
Improve model behavior in `start_prove_task_with_solver`
Mar 25, 2021
e8f7037
Switch to idiomatic `return` in functions of type `(..)->None`
Mar 25, 2021
b1029bb
Apply PEP8 formatting (fixes redundant whitespace)
Mar 25, 2021
a80fff0
riscv: add stack usage configuration for `O2`
mbrcknl Mar 31, 2021
abc7d43
seL4-example: add arch-specific target.py configurations
mbrcknl Mar 31, 2021
e943b0c
seL4-example: move obsolete scripts
mbrcknl Mar 31, 2021
1529b47
Implement "run all proofs" shell script
Mar 31, 2021
c211fbf
Add template solverlists for seL4 binary verification
Mar 31, 2021
8b0f482
cleanup: remove obsolete code, rename misc scripts
mbrcknl Mar 11, 2022
0a521a7
trivial: add missing license headers
mbrcknl Mar 21, 2022
996ab89
trivial: fix broken link in README
mbrcknl Mar 21, 2022
7d760fe
trivial: fix undefined var
mbrcknl Mar 3, 2022
e553dcb
add `GRAPH_REFINE_SOLVERLIST_DIR` env var
mbrcknl Mar 3, 2022
e25ba2a
add `GRAPH_REFINE_VERSION_INFO` env var
mbrcknl Mar 3, 2022
d833f2d
log smt problems under specified directory
mbrcknl Mar 9, 2022
cf83b22
add tools for obtaining a decompiler
mbrcknl Mar 11, 2022
f91aa1d
add Nix deriviation for graph-refine
mbrcknl Mar 11, 2022
7b07fab
ci: build Docker images
mbrcknl Mar 11, 2022
342fa75
add shell.nix
mbrcknl Mar 16, 2022
5159a86
stack_bounds: add support more configurations
mbrcknl Mar 18, 2022
af9960c
seL4-example: refresh Makefile
mbrcknl Mar 16, 2022
754f0da
add a script for hashing a directory tree
mbrcknl Mar 18, 2022
a6a5353
add a script to list functions to be tested
mbrcknl Mar 19, 2022
945334a
ci: add scripts to submit graph-refine job
mbrcknl Mar 20, 2022
da0d97f
add a simple parallel job runner
mbrcknl Mar 24, 2022
dfbac8d
queue: add basic HTML renderer
mbrcknl Mar 25, 2022
1056cdc
ci: Various improvements to support scripts
mbrcknl Jan 19, 2023
d0b2916
ci: Add a web-based view of results
mbrcknl Mar 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions .github/workflows/binary-decompilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Copyright 2022 Kry10 Limited
#
# SPDX-License-Identifier: BSD-2-Clause

name: Binary decompilation

on:
repository_dispatch:
types:
- binary-verification
workflow_dispatch:
inputs:
repo:
description: 'Repository'
required: true
type: string
default: 'seL4/l4v'
run_id:
description: 'Workflow run ID'
required: true
tag:
description: |
A brief description of the source of the event,
e.g. a workflow identifier. This is used when
reporting the results of a binary verification
run, to help users identify the proof run that
triggered the binary verification run.
required: true
type: string
default: 'workflow-dispatch'

jobs:
targets:
# Fetch artifacts from the remote workflow that triggered this one,
# and store them locally in this workflow for easier access during the
# matrix job. Also identify which targets to run in the matrix.
name: Prepare decompilation targets
runs-on: ubuntu-latest
outputs:
targets_enabled: ${{ steps.prepare.outputs.targets_enabled }}
steps:
- name: Indentify trigger
id: id_trigger
# Different event types use different context variables for the inputs,
# so here we figure out which variables to use.
run: |
# Identify source workflow
set -euo pipefail
case "${{ github.event_name }}" in
repository_dispatch)
echo "trigger_repo=${{ github.event.client_payload.repo }}" >> "${GITHUB_OUTPUT}"
echo "trigger_run=${{ github.event.client_payload.run_id }}" >> "${GITHUB_OUTPUT}"
echo "trigger_tag=${{ github.event.client_payload.tag }}" >> "${GITHUB_OUTPUT}"
;;
workflow_dispatch)
echo "trigger_repo=${{ github.event.input.repo }}" >> "${GITHUB_OUTPUT}"
echo "trigger_run=${{ github.event.input.run_id }}" >> "${GITHUB_OUTPUT}"
echo "trigger_tag=${{ github.event.input.tag }}" >> "${GITHUB_OUTPUT}"
;;
*)
echo "Unexpected github.event_name: ${{ github.event_name }}"
exit 1
;;
esac

- name: Download kernel builds from source workflow
uses: seL4/ci-actions/await-remote-artifacts@master
with:
repo: ${{ steps.id_trigger.outputs.trigger_repo }}
run-id: ${{ steps.id_trigger.outputs.trigger_run }}
artifact-names: kernel-builds
token: ${{ secrets.PRIV_REPO_TOKEN }}
download-dir: artifacts

- name: Checkout graph-refine
uses: actions/checkout@v3
with:
path: graph-refine

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: pip install lxml

- name: Prepare job
id: prepare
run: graph-refine/ci/github-prepare-decompile.py artifacts/kernel-builds job
env:
TAG: ${{ steps.id_trigger.outputs.trigger_tag }}
PROOF_REPO: ${{ steps.id_trigger.outputs.trigger_repo }}
PROOF_RUN: ${{ steps.id_trigger.outputs.trigger_run }}
DECOMPILE_REPO: ${{ github.repository }}
DECOMPILE_RUN: ${{ github.run_id }}

- name: Upload job
uses: actions/upload-artifact@v3
with:
name: graph-refine-job
path: job
if-no-files-found: ignore

decompilation:
name: Decompile
needs: targets
if: needs.targets.outputs.targets_enabled != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ${{ fromJSON(needs.targets.outputs.targets_enabled) }}
steps:
- name: Download targets
uses: actions/download-artifact@v3
with:
name: graph-refine-job
path: job
- name: Decompile
run: |
# Decompile
docker run --rm -i \
--mount "type=bind,src=${PWD}/job/targets/${{matrix.target}}/target,dst=/target" \
--mount "type=tmpfs,dst=/tmp" \
ghcr.io/sel4/sel4-decompiler /target
# Isolate current target for re-upload,
# to avoid interference between matrix jobs.
mkdir -p "my-job/targets/${{matrix.target}}"
mv "job/targets/${{matrix.target}}/target" "my-job/targets/${{matrix.target}}/target"
- name: Re-upload target
uses: actions/upload-artifact@v3
with:
name: graph-refine-job
path: my-job

submission:
name: Submit graph-refine job
needs: decompilation
runs-on: ubuntu-latest
steps:
- name: Download targets
uses: actions/download-artifact@v3
with:
name: graph-refine-job
path: job
- name: Checkout graph-refine
uses: actions/checkout@v3
with:
path: graph-refine
- name: Submit graph-refine job
env:
BV_BACKEND_WORK_DIR: bv
BV_SSH_CONFIG: "${{ secrets.BV_SSH_CONFIG }}"
BV_SSH_KEY: "${{ secrets.BV_SSH_KEY }}"
BV_SSH_KNOWN_HOSTS: "${{ secrets.BV_SSH_KNOWN_HOSTS }}"
DOCKER_RUN_COMMAND: "${{ secrets.DOCKER_RUN_COMMAND }}"
JOB_DIR: job
run: graph-refine/ci/submit-graph-refine
122 changes: 122 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Copyright (c) 2022, Kry10 Limited
# SPDX-License-Identifier: BSD-2-Clause

name: Build

on:
# FIXME: When RISC-V and ARM branches are merged to master:
# - switch the push trigger to master,
# - add schedule and pull_request triggers.
push:
branches:
- ci-riscv64

# Ensure Docker image builds are fully serialised,
# so there is not a race to set the `latest` tag.
concurrency:
group: graph-refine-docker-builds
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout graph-refine
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: seL4
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git
env:
CI_SSH: ${{ secrets.CI_SSH }}
shell: bash
run: |
# Configure SSH access and Git identity
eval $(ssh-agent)
ssh-add -q - <<< "${CI_SSH}"
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "${GITHUB_ENV}"
git config --global user.name "seL4 CI"
git config --global user.email "ci@sel4.systems"
# We use the Nix package manager to build Docker images.
- name: Install Nix
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
# We cache Nix builds using cachix.org.
- name: Install Cachix
uses: cachix/cachix-action@v12
with:
name: sel4-bv
authToken: "${{ secrets.BV_CACHIX_AUTH_TOKEN }}"
- name: Build graph-refine
shell: bash
run: |
# Build graph-refine
build_image() { nix-build -A "$1" -o "$1" nix/graph-refine.nix; }
build_image graph-refine-image
build_image graph-refine-runner-image
- name: Load and tag graph-refine images
id: image_tags
run: |
# Load and tag graph-refine images
./graph-refine-image | docker load
./graph-refine-runner-image | docker load
TAG="$(docker image ls --format '{{.Tag}}' graph-refine)"
RUN_TAG="$(docker image ls --format '{{.Tag}}' graph-refine-runner)"
echo "runner_tag=$RUN_TAG" >> "$GITHUB_OUTPUT"
docker tag "graph-refine:$TAG" ghcr.io/sel4/graph-refine:latest
docker tag "graph-refine:$TAG" ghcr.io/sel4/graph-refine:"$TAG"
docker tag "graph-refine-runner:$RUN_TAG" ghcr.io/sel4/graph-refine-runner:latest
docker tag "graph-refine-runner:$RUN_TAG" ghcr.io/sel4/graph-refine-runner:"$RUN_TAG"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Checkout HOL4 and polyml
run: decompiler/setup-decompiler.py checkout --upstream --ssh
- name: Build decompiler
run: |
# Build decompiler
nix-build -A decompiler-image -o decompiler-image decompiler
nix-build -A sel4-decompiler-image -o sel4-decompiler-image seL4-example
- name: Load and tag decompiler image
run: |
# Load and tag decompiler image
./decompiler-image | docker load
./sel4-decompiler-image | docker load
IMAGE_TAG="$(docker image ls --format '{{.Tag}}' decompiler)"
SEL4_IMAGE_TAG="$(docker image ls --format '{{.Tag}}' sel4-decompiler)"
docker tag "decompiler:$IMAGE_TAG" ghcr.io/sel4/decompiler:latest
docker tag "decompiler:$IMAGE_TAG" ghcr.io/sel4/decompiler:"$IMAGE_TAG"
docker tag "sel4-decompiler:$SEL4_IMAGE_TAG" ghcr.io/sel4/sel4-decompiler:latest
docker tag "sel4-decompiler:$SEL4_IMAGE_TAG" ghcr.io/sel4/sel4-decompiler:"$SEL4_IMAGE_TAG"
- name: Push upstream branches
if: github.event_name == 'push' || github.event_name == 'schedule'
run: |
# Push upstream branches
(cd decompiler/src/HOL4 && git push)
(cd decompiler/src/polyml && git push)
- name: Push Docker images
if: github.event_name == 'push' || github.event_name == 'schedule'
run: |
# Push Docker images
docker push --all-tags ghcr.io/sel4/graph-refine
docker push --all-tags ghcr.io/sel4/graph-refine-runner
docker push --all-tags ghcr.io/sel4/decompiler
docker push --all-tags ghcr.io/sel4/sel4-decompiler
# Ensure the graph-refine backend is using an up-to-date runner
- name: Install graph-refine-runner
if: github.event_name == 'push' || github.event_name == 'schedule'
env:
BV_BACKEND_WORK_DIR: bv
BV_BACKEND_CONCURRENCY: 64
BV_SSH_CONFIG: "${{ secrets.BV_SSH_CONFIG }}"
BV_SSH_KEY: "${{ secrets.BV_SSH_KEY }}"
BV_SSH_KNOWN_HOSTS: "${{ secrets.BV_SSH_KNOWN_HOSTS }}"
DOCKER_RUN_COMMAND: "${{ secrets.DOCKER_RUN_COMMAND }}"
RUNNER_TAG: "${{ steps.image_tags.outputs.runner_tag }}"
run: ci/install-runner
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@
#

.pyc
/internal/
__pycache__/

# Nix
/result*

# Decompiler setup
/decompiler/decompile
/decompiler/src/
/decompiler/install/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use of SMT solvers.
The design and theory of this tool are described in the paper [Translation
Validation for a Verified OS Kernel][1] by Sewell, Myreen & Klein.

[1]: https://ts.data61.csiro.au/publications/nictaabstracts/Sewell_MK_13.abstract "Translation Validation for a Verified OS Kernel"
[1]: https://trustworthy.systems/publications/nictaabstracts/Sewell_MK_13.abstract "Translation Validation for a Verified OS Kernel"

Repository Setup
----------------
Expand Down
54 changes: 27 additions & 27 deletions c_rodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@
import target_objects

def get_cache (p):
k = 'c_rodata_hook_cache'
if k not in p.cached_analysis:
p.cached_analysis[k] = {}
return p.cached_analysis[k]
k = 'c_rodata_hook_cache'
if k not in p.cached_analysis:
p.cached_analysis[k] = {}
return p.cached_analysis[k]

def hook (rep, (n, vc)):
p = rep.p
tag = p.node_tags[n][0]
is_C = tag == 'C' or p.hook_tag_hints.get (tag, None) == 'C'
if not is_C:
return
upd_ps = [rep.to_smt_expr (ptr, (n, vc))
for (kind, ptr, v, m) in p.nodes[n].get_mem_accesses ()
if kind == 'MemUpdate']
if not upd_ps:
return
cache = get_cache (p)
for ptr in set (upd_ps):
pc = rep.get_pc ((n, vc))
eq_rodata = rep.solv.get_eq_rodata_witness (ptr)
hyp = rep.to_smt_expr (syntax.mk_implies (pc,
syntax.mk_not (eq_rodata)), (n, vc))
if ((n, vc), ptr) in cache:
res = cache[((n, vc), ptr)]
else:
res = rep.test_hyp_whyps (hyp, [], cache = cache)
cache[((n, vc), ptr)] = res
if res:
rep.solv.assert_fact (hyp, {})
p = rep.p
tag = p.node_tags[n][0]
is_C = tag == 'C' or p.hook_tag_hints.get (tag, None) == 'C'
if not is_C:
return
upd_ps = [rep.to_smt_expr (ptr, (n, vc))
for (kind, ptr, v, m) in p.nodes[n].get_mem_accesses ()
if kind == 'MemUpdate']
if not upd_ps:
return
cache = get_cache (p)
for ptr in set (upd_ps):
pc = rep.get_pc ((n, vc))
eq_rodata = rep.solv.get_eq_rodata_witness (ptr)
hyp = rep.to_smt_expr (syntax.mk_implies (pc,
syntax.mk_not (eq_rodata)), (n, vc))
if ((n, vc), ptr) in cache:
res = cache[((n, vc), ptr)]
else:
res = rep.test_hyp_whyps (hyp, [], cache = cache)
cache[((n, vc), ptr)] = res
if res:
rep.solv.assert_fact (hyp, {})

module_hook_k = 'c_rodata'
target_objects.add_hook ('post_emit_node', module_hook_k, hook)
Expand Down
Loading