Skip to content

Commit

Permalink
Option to add repo path, temp fix for path in Package file; LIBAFL.md
Browse files Browse the repository at this point in the history
  • Loading branch information
parthdt committed Nov 5, 2024
1 parent 27144f9 commit 9be0f16
Show file tree
Hide file tree
Showing 13 changed files with 900 additions and 693 deletions.
12 changes: 12 additions & 0 deletions LIBAFL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## LibAFL - Fuzzilli

The `Sources/libafl` directory contains autogenerated code from libafl. It is built into a library and used in Fuzzilli to integrate interesting features.

To run this fork, please do:

1. Change the path variable in the `Package.swift` file. Ensure it points to the top dir of Fuzzilli.
2. Ensure proper linker settings. Do:
```
export LD_LIBRARY_PATH=`pwd`/Sources/libafl
```
3. Build and run Fuzzilli. Sample run with `ParthCorpus`: `swift run -c release FuzzilliCli --profile=spidermonkey ~/gecko-dev/obj-fuzzbuild/dist/bin/js --inspect=history --corpus=parth`
31 changes: 16 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import PackageDescription

let path = "/home/dresden/fuzzing/optfuzzilli/fuzzilli"
let package = Package(
name: "Fuzzilli",
platforms: [
Expand All @@ -40,13 +41,13 @@ let package = Package(
linkerSettings: [.linkedLibrary("rt", .when(platforms: [.linux]))]),

.target(
name:"libpc",
path:"Sources/libpc",
name:"libafl",
path:"Sources/libafl",
swiftSettings: [
.unsafeFlags(["-I/home/dresden/fuzzing/fuzzilli/Sources/libpc","-Xcc","-fmodule-map-file=/home/dresden/fuzzing/fuzzilli/Sources/libpc/parth_corpusFFI.modulemap"]), // Adjust paths as necessary
.unsafeFlags(["-I\(path)/Sources/libafl","-Xcc","-fmodule-map-file=\(path)/Sources/libafl/libafl_fuzzilliFFI.modulemap"]), // Adjust paths as necessary
],
linkerSettings: [
.unsafeFlags(["-L/home/dresden/fuzzing/fuzzilli/Sources/libpc", "-lparth_corpus"])]
.unsafeFlags(["-L\(path)/Sources/libafl", "-llibafl_fuzzilli"])]

),

Expand All @@ -56,7 +57,7 @@ let package = Package(
"libsocket",
"libreprl",
"libcoverage",
"libpc"],
"libafl"],

exclude: [
"Protobuf/operations.proto",
Expand All @@ -69,38 +70,38 @@ let package = Package(
.copy("Protobuf/ast.proto"),
.copy("Compiler/Parser")],
swiftSettings: [
.unsafeFlags(["-I/home/dresden/fuzzing/fuzzilli/Sources/libpc","-Xcc","-fmodule-map-file=/home/dresden/fuzzing/fuzzilli/Sources/libpc/parth_corpusFFI.modulemap"]), // Adjust paths as necessary
.unsafeFlags(["-I\(path)/Sources/libafl","-Xcc","-fmodule-map-file=\(path)/Sources/libafl/libafl_fuzzilliFFI.modulemap"]), // Adjust paths as necessary
],
linkerSettings: [
.linkedLibrary("parth_corpus"),
.unsafeFlags(["-L/home/dresden/fuzzing/fuzzilli/Sources/libpc", "-lpc"])]),
.linkedLibrary("libafl_fuzzilli"),
.unsafeFlags(["-L\(path)/Sources/libafl", "-lfs"])]),

.target(name: "REPRLRun",
dependencies: ["libreprl"]),

.target(name: "FuzzilliCli",
dependencies: ["Fuzzilli"],
swiftSettings: [
.unsafeFlags(["-I/home/dresden/fuzzing/fuzzilli/Sources/libpc","-Xcc","-fmodule-map-file=/home/dresden/fuzzing/fuzzilli/Sources/libpc/parth_corpusFFI.modulemap"]), // Adjust paths as necessary
.unsafeFlags(["-I\(path)/Sources/libafl","-Xcc","-fmodule-map-file=\(path)/Sources/libafl/libafl_fuzzilliFFI.modulemap"]), // Adjust paths as necessary
],
linkerSettings: [
.linkedLibrary("parth_corpus"),
.unsafeFlags(["-L/home/dresden/fuzzing/fuzzilli/Sources/libpc", "-lpc"])]
.linkedLibrary("libafl_fuzzilli"),
.unsafeFlags(["-L\(path)/Sources/libafl", "-lfs"])]
),

.target(name: "FuzzILTool",
dependencies: ["Fuzzilli"],
swiftSettings: [
.unsafeFlags(["-I/home/dresden/fuzzing/fuzzilli/Sources/libpc","-Xcc","-fmodule-map-file=/home/dresden/fuzzing/fuzzilli/Sources/libpc/parth_corpusFFI.modulemap"]), // Adjust paths as necessary
.unsafeFlags(["-I\(path)/Sources/libafl","-Xcc","-fmodule-map-file=\(path)/Sources/libafl/libafl_fuzzilliFFI.modulemap"]), // Adjust paths as necessary
],
linkerSettings: [
// .linkedLibrary("parth_corpus"),
.unsafeFlags(["-L/home/dresden/fuzzing/fuzzilli/Sources/libpc", "-lpc"])]
// .linkedLibrary("libafl_fuzzilli"),
.unsafeFlags(["-L\(path)/Sources/libafl", "-lfs"])]
),

.testTarget(name: "FuzzilliTests",
dependencies: ["Fuzzilli"],
resources: [.copy("CompilerTests")]),
],
swiftLanguageVersions: [.v5]
)
)
2 changes: 1 addition & 1 deletion Sources/Fuzzilli/Corpus/ParthCorpus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import Foundation
import libpc
import libafl

let filteredFunctionsForCompiler = [
"assert*",
Expand Down
Loading

0 comments on commit 9be0f16

Please sign in to comment.