Skip to content

Commit 807625f

Browse files
author
Samuel Groß
committed
Add a basic JavaScript-to-FuzzIL compiler
The new compiler: - Is (mostly) written in Swift to ensure that changes to FuzzIL are reflected in the compiler. - Features an "end-to-end" testsuite that runs as part of `swift test`. The testsuite consists of a number of JavaScript programs which are compiled to FuzzIL, then lifted back to JavaScript and checked to produce the same output as the original code. - Uses a (fairly) stable protobuf-based AST format which is currently produced by a node.js-based parser (since there seem to be no good JavaScript parsers with swift integration), but could also be produced by any other parser. The compiler is still quite far away from being feature complete but it should support the most important language features. Adding support for more features is usually relatively simple: typically it involves adding one or more tests to the testuite, adding the relevant AST nodes to ast.proto, updating the parser script to emit these nodes, and updating the compiler to handle them. However, some features may require changes to FuzzIL, such as proper handling of loop headers. The compiler is currently exposed through the FuzzILTool's --compile option. In the future we may want to have a more sophisticated CLI interface, for example to allow removing calls to certain functions (such as assertX from tests) from the compiled code.
1 parent c8b25c3 commit 807625f

156 files changed

Lines changed: 7815 additions & 10340 deletions

File tree

Some content is hidden

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

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ Package.resolved
55
/*.xcodeproj
66
.vscode
77
.*.sw?
8+
.swiftpm
89

910
# custom GCE configuration
1011
Cloud/GCE/config.sh
12+
13+
# node.js dependencies, used by the JavaScript parser for the FuzzIL compiler
14+
node_modules
15+
package-lock.json

‎Cloud/Docker/Corpus/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*js
2+
*fuzzil.protobuf

‎Cloud/Docker/Dockerfile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ ADD DuktapeBuilder/out duktape
2323
# Add JerryScript binary
2424
ADD JerryScriptBuilder/out jerryscript
2525

26+
# Add Corpus (if any)
27+
ADD Corpus corpus
28+
2629
# Add Fuzzilli binaries
2730
ADD FuzzilliBuilder/out/Fuzzilli Fuzzilli
2831
ADD FuzzilliBuilder/out/REPRLRun REPRLRun

‎Cloud/GCE/config-template.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ BINARY=./v8/d8
1919
FUZZILLI_ARGS="--profile=v8"
2020
# Arguments for the root instance. See ./Fuzzilli --help
2121
FUZZILLI_ROOT_ARGS="--exportStatistics"
22+
# Arguments for the intermediate instances. See ./Fuzzilli --help
23+
FUZZILLI_INTERMEDIATE_ARGS=""
2224
# Arguments for the leaf instances. See ./Fuzzilli --help
2325
FUZZILLI_LEAF_ARGS=""
2426

‎Cloud/GCE/start.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ if [ "$START_INTERMEDIATES" = true ]; then
165165
--container-tty \
166166
--container-command=/bin/bash \
167167
--container-arg="-c" \
168-
--container-arg="sysctl -w 'kernel.core_pattern=|/bin/false' && ./Fuzzilli --instanceType=intermediate --connectTo=$parent_ip:1337 --bindTo=0.0.0.0:1337 $FUZZILLI_ARGS $BINARY" \
168+
--container-arg="sysctl -w 'kernel.core_pattern=|/bin/false' && ./Fuzzilli --instanceType=intermediate --connectTo=$parent_ip:1337 --bindTo=0.0.0.0:1337 $FUZZILLI_ARGS $FUZZILLI_INTERMEDIATE_ARGS $BINARY" \
169169
--network-tier=PREMIUM \
170170
--maintenance-policy=MIGRATE \
171171
--labels=container-vm=$IMAGE,level=$level,role=intermediate,session=$SESSION

‎Compiler/.gitignore‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎Compiler/Dockerfile‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎Compiler/README.md‎

Lines changed: 0 additions & 110 deletions
This file was deleted.

‎Compiler/bin/dune‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎Compiler/bin/fuzzilli_compiler.ml‎

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)