Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c420a2a
remove unused expressions
butterunderflow Jul 5, 2025
fb2a2c4
let's start from the staged miniwasm interpreter
butterunderflow Jul 7, 2025
27e3e32
dup all concrete operations to symbolic
butterunderflow Jul 7, 2025
2143050
maintain a symbolic stack during the execution
butterunderflow Jul 7, 2025
8d81fbe
record path conditions
butterunderflow Jul 9, 2025
61215b6
The branch node only needs to remember the positive condition.
butterunderflow Jul 9, 2025
d18b5f7
symbolic runtime for explore tree
butterunderflow Jul 13, 2025
92ab8ba
add a to graphviz method, enhancing debug experience
butterunderflow Jul 13, 2025
e1d7fc8
put symbolic expression on the SymStack
butterunderflow Jul 14, 2025
77a4e6f
`type.symbolic` instruction
butterunderflow Jul 16, 2025
314ff5f
test staged concolic compilation in CI
butterunderflow Jul 16, 2025
8739369
dump graphviz by default
butterunderflow Jul 16, 2025
9a9988c
concolic driver
butterunderflow Jul 17, 2025
9ab162f
fix: add an unreachable node & use GENSYM_ASSERT
butterunderflow Jul 18, 2025
b75a627
call z3 to solve constraints
butterunderflow Jul 19, 2025
26c9917
remove unused & resize before update environment
butterunderflow Jul 19, 2025
319cfd6
use c++20
butterunderflow Jul 23, 2025
8f45912
branch in brtable
butterunderflow Jul 23, 2025
2e2259d
use driver's entrypoint by default
butterunderflow Jul 23, 2025
2b42b27
rename package name of staged miniwasm
butterunderflow Jul 23, 2025
619a8f0
tweak
butterunderflow Jul 23, 2025
af6751a
Reuse symbolic states (#90)
butterunderflow Aug 27, 2025
731ff9e
c++17 compatible
butterunderflow Aug 27, 2025
ffa5670
fix
butterunderflow Aug 29, 2025
b57929a
revert: don't split concrete/symbolic interpreter & don't support sna…
butterunderflow Aug 29, 2025
1bdb7da
introduce a SnapshotNode, which currently behaves same as UnexploredNode
butterunderflow Aug 30, 2025
64dce32
fill snapshot into SnapshotNode
butterunderflow Aug 30, 2025
463871c
snapshot reuse via continuation
butterunderflow Aug 31, 2025
261c650
remove debug printings
butterunderflow Sep 1, 2025
1c6a045
give every branch node an ID
butterunderflow Sep 4, 2025
8971eb5
a bitmap to record the branch coverage
butterunderflow Sep 4, 2025
1b92fc0
a new exploring strategy: exit when all branches are covered
butterunderflow Sep 4, 2025
0f7ca5a
support numeric globals
butterunderflow Sep 7, 2025
0fded4c
Explicitly classify the next stage computation and its type
butterunderflow Sep 9, 2025
5656536
correct behavior for global
ahuoguo Sep 10, 2025
51544e8
make log function returning std::monostate/Unit type
butterunderflow Sep 23, 2025
4bdc93b
Symbolic memory (#91)
ahuoguo Sep 24, 2025
74732ad
fix: high bits should be concat first
butterunderflow Sep 24, 2025
e3f8488
make btree example work with concolic execution
butterunderflow Sep 29, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ jobs:
sbt 'testOnly gensym.wasm.TestConcolic'
sbt 'testOnly gensym.wasm.TestDriver'
sbt 'testOnly gensym.wasm.TestStagedEval'
sbt 'testOnly gensym.wasm.TestStagedConcolicEval'
7 changes: 7 additions & 0 deletions benchmarks/wasm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: clean

clean:
find . -type f -name '*.cpp' -delete
find . -type f -name '*.cpp.exe' -delete
find . -type d -name '*.dSYM' -exec rm -rf {} +
find . -type f -name '*.dot' -delete
1 change: 1 addition & 0 deletions benchmarks/wasm/branch-strip-buggy.wat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
else
i32.const 0
call 2
i32.const 1 ;; to satisfy the type checker, this line will never be reached
end
end
)
Expand Down
5 changes: 4 additions & 1 deletion benchmarks/wasm/btree/2o1u-unlabeled.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2626,9 +2626,12 @@
i32.and
drop)
(func (;7;) (type 4)
i32.const 3
i32.const 2
i32.symbolic
i32.const 1
i32.symbolic
i32.const 0
i32.symbolic
call 6)
(memory (;0;) 2)
(export "main" (func 7))
Expand Down
21 changes: 21 additions & 0 deletions benchmarks/wasm/global-sym.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(module
(type (;0;) (func (result i32)))
(type (;1;) (func))
(type (;2;) (func (param i32) (result i32)))

(func (;0;) (type 2) (param i32) (result i32)
local.get 0
global.set 0
global.get 0
)
(func (;1;) (type 1)
i32.const 0
i32.symbolic
;; TODO Somehow this value is always 0?
call 0
)
(start 1)
(memory (;0;) 2)
(export "main" (func 1))
(global (;0;) (mut i32) (i32.const 42))
)
19 changes: 19 additions & 0 deletions benchmarks/wasm/load-offset.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(module
(type (;0;) (func (result i32)))
(type (;1;) (func))
(func (;0;) (type 0) (result i32)
i32.const 0
i32.const 256
i32.store
i32.const 0
i32.load offset=1
)
(func (;1;) (type 1)
call 0
;; should be 1
;; drop
)
(start 1)
(memory (;0;) 2)
(export "main" (func 1))
)
19 changes: 19 additions & 0 deletions benchmarks/wasm/load-overflow1.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(module
(type (;0;) (func (result i32)))
(type (;1;) (func))
(func (;0;) (type 0) (result i32)
i32.const 0
i32.const 256
i32.store
i32.const 1
i32.load
)
(func (;1;) (type 1)
call 0
;; should be 1
;; drop
)
(start 1)
(memory (;0;) 2)
(export "main" (func 1))
)
19 changes: 19 additions & 0 deletions benchmarks/wasm/load-overflow2.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(module
(type (;0;) (func (result i32)))
(type (;1;) (func))
(func (;0;) (type 0) (result i32)
i32.const 0
i32.const 65536
i32.store
i32.const 2
i32.load
)
(func (;1;) (type 1)
call 0
;; should be 1
;; drop
)
(start 1)
(memory (;0;) 2)
(export "main" (func 1))
)
2 changes: 1 addition & 1 deletion benchmarks/wasm/load.wat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)
(func (;1;) (type 1)
call 0
;; should be 65536
;; should be 1
;; drop
)
(start 1)
Expand Down
32 changes: 32 additions & 0 deletions benchmarks/wasm/mem-sym-extract.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(module
(type (;0;) (func (result i32)))
(type (;1;) (func))
(type (;2;) (func (param i32) (result i32)))
(type (;3;) (func (param i32)))
(import "console" "assert" (func (type 3)))
(func (;1;) (type 2) (param i32) (result i32)
i32.const 0
local.get 0
i32.store
i32.const 0
i32.load
i32.const 1
i32.eq
if (result i32) ;; if x == 256
i32.const 1 ;; return 1
else
i32.const 0
call 0 ;; assert false
i32.const 1 ;; to satisfy the type checker, this line will never be reached
end
)
(func (;2;) (type 1)
i32.const 0
i32.symbolic ;; call it x
call 1
)
(start 2)
(memory (;0;) 2)
(export "main" (func 1))
(global (;0;) (mut i32) (i32.const 42))
)
43 changes: 43 additions & 0 deletions benchmarks/wasm/mem-sym.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
(module
(type (;0;) (func (result i32)))
(type (;1;) (func))
(type (;2;) (func (param i32) (result i32)))
(type (;3;) (func (param i32)))
(import "console" "assert" (func (type 3)))
(func (;1;) (type 2) (param i32) (result i32)
i32.const 0
local.get 0
i32.store
i32.const 0
i32.load
i32.const 25
i32.eq
if (result i32) ;; if x == 25
i32.const 0
call 0 ;; assert false
i32.const 1 ;; to satisfy the type checker, this line will never be reached
else
i32.const 1
i32.load
i32.const 1
i32.eq
if (result i32) ;; if x >> 8 == 1
i32.const 0
call 0 ;; assert false
i32.const 1 ;; to satisfy the type checker, this line will never be reached
else
i32.const 1
end
i32.const 1
end
)
(func (;2;) (type 1)
i32.const 0
i32.symbolic ;; call it x
call 1
)
(start 2)
(memory (;0;) 2)
(export "main" (func 1))
(global (;0;) (mut i32) (i32.const 42))
)
22 changes: 22 additions & 0 deletions benchmarks/wasm/staged/brtable_concolic.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(module $brtable
(global (;0;) (mut i32) (i32.const 1048576))
(type (;0;) (func (param i32)))
(func (;0;) (type 1) (result i32)
i32.const 2
(block
(block
(block
i32.const 0
i32.symbolic
br_table 0 1 2 0 ;; br_table will consume an element from the stack
)
i32.const 1
call 1
br 1
)
i32.const 0
call 1
)
)
(import "console" "assert" (func (type 0)))
(start 0))
19 changes: 19 additions & 0 deletions benchmarks/wasm/staged/return_poly.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(module
(type (;0;) (func))
(type (;1;) (func (result i32)))
;; TODO: It seems that our parser or preprocessor has some problems; the result type of the last line doesn't take effect
(func (result i32)
block
i32.const 21
i32.const 35
i32.const 42
return
end
i32.const 100
)
(func (type 0)
call 0
;; unreachable
)
(export "$real_main" (func 1))
)
22 changes: 22 additions & 0 deletions benchmarks/wasm/staged/simple_global.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(module $simple_global
(type (;0;) (func (param i32 i32) (result i32)))
(type (;1;) (func (result i32)))
(type (;2;) (func (param i32)))
(func $real_main (type 1) (result i32)
(local i32)
i32.const 0
i32.symbolic
local.tee 0
local.get 0
global.set 0
if
else
i32.const 0
call 1
end)
(import "console" "assert" (func (type 2)))
(memory (;0;) 16)
(global $__stack_pointer (mut i32) (i32.const 1048576))
(global (;1;) i32 (i32.const 1048576))
(global (;2;) i32 (i32.const 1048576))
(export "real_main" (func 0)))
4 changes: 3 additions & 1 deletion headers/wasm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
#define WASM_HEADERS

#include "wasm/concrete_rt.hpp"

#include "wasm/symbolic_rt.hpp"
#include "wasm/concolic_driver.hpp"
#include "wasm/utils.hpp"
#endif
Loading