Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5af02bf
Added flag to toggle memory encoding transform
mira-alford Jan 14, 2026
336a1fc
Changed memory encoding to use a transform
mira-alford Jan 14, 2026
253042c
Partially specified malloc for changes to object mapping/alloc ids
mira-alford Jan 14, 2026
0425308
Specified position map update for malloc
mira-alford Jan 14, 2026
4733084
Specified malloc, excluding gamma values
mira-alford Jan 14, 2026
29261c9
Fixed some type issues in the generated boogie
mira-alford Jan 14, 2026
7b98452
Memory encoding valid function
mira-alford Jan 19, 2026
20ff704
Rewrote malloc to be more boogie friendly, added free spec
mira-alford Jan 19, 2026
00e5788
Modifies clauses and valid assertions
mira-alford Jan 19, 2026
df2a068
Specified disjointedness
mira-alford Jan 19, 2026
f0d7f11
Working specification, though would benefit from triggers
mira-alford Jan 20, 2026
392e457
Memory encoding seems functional
mira-alford Jan 21, 2026
f21a2ff
Cleaned up memory encoding
mira-alford Jan 21, 2026
a5645e6
Memory encoding accounts for global symbols as unallocated pointers
mira-alford Jan 27, 2026
321eb14
Simplified checks for global variables, could move to elf sections in…
mira-alford Jan 28, 2026
0d6d4eb
fixed triggers
mira-alford Jan 28, 2026
fc707e4
Specified memset
mira-alford Jan 28, 2026
04c00a3
strlen specified
mira-alford Jan 28, 2026
649022a
debugging strlen
mira-alford Jan 28, 2026
0506889
strlen specified
mira-alford Feb 2, 2026
27c8ac6
Free requires high security
mira-alford Feb 2, 2026
347adc8
Strlen existential
mira-alford Feb 3, 2026
1c3a689
Cleaned up testing
mira-alford Feb 4, 2026
9e1c793
Cleaned up produced boogie and memory encoding
mira-alford Feb 4, 2026
6722ec2
added memory encoding flag for boogie generator
mira-alford Feb 4, 2026
81bbdd4
swapping to IR contracts maybe
mira-alford Feb 4, 2026
69c936c
most of the ir experimentation done, not sure it was a good idea
mira-alford Feb 9, 2026
82b2382
Passing mem encoding tests on IR
mira-alford Feb 10, 2026
4305111
working under simplify conditions
mira-alford Feb 11, 2026
d451445
Tests use simplify, slight tweak to summary generator to not overwrit…
mira-alford Feb 11, 2026
51667a9
Merged with main
mira-alford Feb 11, 2026
f7a5f2b
Removed dead code
mira-alford Feb 11, 2026
720c8f2
Removed more dead code
mira-alford Feb 11, 2026
9f05a24
Removed some comments
mira-alford Feb 11, 2026
27eb6d6
Removed some comments
mira-alford Feb 11, 2026
2feec02
Satisfied scala fmt
mira-alford Feb 11, 2026
257121e
Satisfied scala fmt really this time
mira-alford Feb 11, 2026
8dc4dea
Slightly longer timeout for memory encoding tests
mira-alford Feb 11, 2026
860a97d
Moved memory validity asserts into transform
mira-alford Feb 16, 2026
84041a6
Code cleanup
mira-alford Feb 16, 2026
7bbd519
Code cleanup
mira-alford Feb 16, 2026
9b86995
Split up memory encoding
mira-alford Feb 17, 2026
8c2660d
Split up memory encoding
mira-alford Feb 18, 2026
840b67b
Fix to concat
mira-alford Feb 18, 2026
23d5ac2
Datatype declaration for boogie
mira-alford Feb 18, 2026
b64685e
Abstracted all of the memory encoding state away into a single datatype
mira-alford Feb 18, 2026
fca35aa
SharedMemorySplit
mira-alford Feb 23, 2026
e7edda8
Initial split heap model... very ugly changes that will probably brea…
mira-alford Feb 24, 2026
27df6f4
Working towards abstraction over memory encoding, breaks everything
mira-alford Feb 24, 2026
f3944f8
Back into a compiling state with new memory encoding abstraction, tho…
mira-alford Feb 24, 2026
60936f9
partial memory spec
mira-alford Apr 1, 2026
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
77 changes: 77 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-mill.url = "github:NixOS/nixpkgs/914a3a6a1024f495af1f5a35c420b170d8b946dd";
pac-nix.url = "github:katrinafyi/pac-nix";
};

outputs =
{
self,
nixpkgs,
nixpkgs-mill,
flake-utils,
pac-nix,
}:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system:
let
pkgs = import nixpkgs {
inherit system;
};

millPkgs = import nixpkgs-mill {
inherit system;
};
in
{
devShell = pkgs.mkShell {
LD_LIBRARY_PATH = "${pkgs.gmp}/lib:";

buildInputs =
(with pkgs; [
scala
scala-cli
ctags
metals
jdk
boogie
coursier
gmp
# z3
cvc5
antlr
haskellPackages.BNFC

pkgsCross.aarch64-multiplatform.pkgsBuildHost.gcc
pkgsCross.aarch64-multiplatform.pkgsBuildHost.clang
pkgsCross.aarch64-multiplatform.pkgsBuildHost.llvmPackages.clang

pkgsCross.aarch64-multiplatform-musl.pkgsBuildHost.gcc
pkgsCross.aarch64-multiplatform-musl.pkgsBuildHost.clang
pkgsCross.aarch64-multiplatform-musl.pkgsBuildHost.llvmPackages.clang
sbt

just

# bincaml stuff:
ocaml
ocamlPackages.ocaml-lsp
opam
# gnumake
])
++ (with millPkgs; [
# mill
])
++ [
pac-nix.packages.${system}.ddisasm
pac-nix.packages.${system}.gtirb-semantics
pac-nix.packages.${system}.gtirb-pprinter
pac-nix.packages.${system}.basil
pac-nix.packages.${system}.asli
];
};
}
);
}
35 changes: 32 additions & 3 deletions src/main/scala/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import util.{
BoogieGeneratorConfig,
BoogieMemoryAccessMode,
DSAPhase,
MemoryEncodingRepresentation,
DSConfig,
DebugDumpIRLogger,
ILLoadingConfig,
Expand Down Expand Up @@ -264,7 +265,14 @@ object Main {
@arg(name = "noif", doc = "Disable information flow security transform in Boogie output")
noif: Flag,
@arg(name = "nodebug", doc = "Disable runtime debug assertions")
noDebug: Flag
noDebug: Flag,
@arg(
name = "memory-encoding",
doc = """Enable memory encoding. options: flat | split(,reverseOrder)(,splitMem).
| flat: maps pointers to abstract metadata leveraging quantifiers + triggers for regions.
| split: embeds base + offset into pointers, reducing maximum allocations/allocation size but eliminating quantifiers and most pointer metadata. reverseOrder changes mapping to (offset -> base) and splitMem splits heap load/stores."""
)
memoryEncoding: Option[String]
)

def main(args: Array[String]): Unit = {
Expand Down Expand Up @@ -380,13 +388,33 @@ object Main {
throw new IllegalArgumentException("Illegal argument for --assert-callee-saved. allowed: (auto|always|never)")
}

val memoryEncodingRepresentation = conf.memoryEncoding match
case None => None
case Some("flat") | Some("") => Some(MemoryEncodingRepresentation.Flat)
case Some(s) if s.slice(0, 5) == "split" => {
val parts = s.split(',')
Some(MemoryEncodingRepresentation.Split(
splitMem = parts.contains("splitMem"),
baseFirst = !parts.contains("reverseOrder")
))
}
case Some(_) =>
throw new IllegalArgumentException("Illegal option to memory-encoding, allowed are: flat | split(,reverseOrder)(,splitMem)")

val boogieMemoryAccessMode = if (conf.lambdaStores.value) {
BoogieMemoryAccessMode.LambdaStoreSelect
} else {
BoogieMemoryAccessMode.SuccessiveStoreSelect
}
val boogieGeneratorConfig =
BoogieGeneratorConfig(boogieMemoryAccessMode, true, rely, conf.threadSplit.value, conf.noif.value)
BoogieGeneratorConfig(
boogieMemoryAccessMode,
true,
rely,
conf.threadSplit.value,
conf.noif.value,
memoryEncoding = memoryEncodingRepresentation
)

var loadingInputs = if (conf.bapInputDirName.isDefined) then {
loadDirectory(ChooseInput.Bap, conf.bapInputDirName.get)
Expand Down Expand Up @@ -488,7 +516,8 @@ object Main {
outputPrefix = conf.outFileName,
dsaConfig = dsa,
memoryTransform = conf.memoryTransform.value,
assertCalleeSaved = calleeSaved
assertCalleeSaved = calleeSaved,
memoryEncoding = memoryEncodingRepresentation
)

Logger.info(programNameVersionHeader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def getGenerateProcedureSummariesTransform(simplified: Boolean): Transform =

val summaryGenerator = SummaryGenerator(prog, simplified)
for procedure <- prog.procedures if procedure != prog.mainProcedure do
procedure.requires = summaryGenerator.generateRequires(procedure)
procedure.ensures = summaryGenerator.generateEnsures(procedure)
procedure.requires ++= summaryGenerator.generateRequires(procedure)
procedure.ensures ++= summaryGenerator.generateEnsures(procedure)

man.ClobberAll
},
Expand Down
Loading