Skip to content

Commit 5966bb0

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[v8] Allow argument randomization for V8SandboxProfile
This makes the V8SandboxProfile more powerful by reusing the argument randomization of the regular V8Profile. It also adds more arguments to the default set: --expose-externalize-string: seems to be unused, doesn't hurt --wasm-test-streaming: Needed for d8 streaming APIs Staged features: --future --harmony --experimental-fuzzing --js-staging --wasm-staging --experimental-wasm-rab-integration Fast API: --wasm-fast-api --expose-fast-api Change-Id: Ied92d69ad21b5ef1de4fab90fb2c07b7023ea078 Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/8741396 Reviewed-by: Samuel Groß <saelo@google.com> Commit-Queue: Matthias Liedtke <mliedtke@google.com>
1 parent aab1873 commit 5966bb0

3 files changed

Lines changed: 29 additions & 32 deletions

File tree

Sources/FuzzilliCli/Profiles/V8CommonProfile.swift

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,10 @@ public let FastApiCallFuzzer = ProgramTemplate("FastApiCallFuzzer") { b in
651651
b.build(n: 10)
652652
}
653653

654-
public func v8ProcessArgs(randomize: Bool) -> [String] {
654+
// Configure V8 invocation arguments. `forSandbox` is used by the V8SandboxProfile. As the sandbox
655+
// fuzzer does not crash on regular assertions, most validation flags do not make sense in that
656+
// configuraiton.
657+
public func v8ProcessArgs(randomize: Bool, forSandbox: Bool) -> [String] {
655658
var args = [
656659
"--expose-gc",
657660
"--expose-externalize-string",
@@ -699,7 +702,7 @@ public func v8ProcessArgs(randomize: Bool) -> [String] {
699702
// Note that this flag only affects WebAssembly.
700703
if probability(0.5) {
701704
args.append("--no-liftoff")
702-
if probability(0.3) {
705+
if probability(0.3) && !forSandbox {
703706
args.append("--wasm-assert-types")
704707
}
705708
}
@@ -807,21 +810,27 @@ public func v8ProcessArgs(randomize: Bool) -> [String] {
807810
//
808811
// Sometimes enable additional verification/stressing logic (which may be fairly expensive).
809812
//
810-
if probability(0.1) {
811-
args.append("--verify-heap")
812-
}
813-
if probability(0.1) {
814-
args.append("--turbo-verify")
815-
}
816-
if probability(0.1) {
817-
args.append("--turbo-verify-allocation")
818-
}
819-
if probability(0.1) {
820-
args.append("--assert-types")
821-
}
822-
if probability(0.1) {
823-
args.append("--turboshaft-assert-types")
813+
if !forSandbox {
814+
if probability(0.1) {
815+
args.append("--verify-heap")
816+
}
817+
if probability(0.1) {
818+
args.append("--turbo-verify")
819+
}
820+
if probability(0.1) {
821+
args.append("--turbo-verify-allocation")
822+
}
823+
if probability(0.1) {
824+
args.append("--assert-types")
825+
}
826+
if probability(0.1) {
827+
args.append("--turboshaft-assert-types")
828+
}
829+
if probability(0.2) {
830+
args.append("--turboshaft-verify-load-elimination")
831+
}
824832
}
833+
825834
if probability(0.1) {
826835
args.append("--deopt-every-n-times=\(chooseUniform(from: [100, 250, 500, 1000, 2500, 5000, 10000]))")
827836
}
@@ -831,9 +840,6 @@ public func v8ProcessArgs(randomize: Bool) -> [String] {
831840
if probability(0.1) {
832841
args.append("--optimize-on-next-call-optimizes-to-maglev")
833842
}
834-
if probability(0.2) {
835-
args.append("--turboshaft-verify-load-elimination")
836-
}
837843

838844
//
839845
// A gc-stress session with some fairly expensive flags.

Sources/FuzzilliCli/Profiles/V8Profile.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import Fuzzilli
1616

1717
let v8Profile = Profile(
18-
processArgs: v8ProcessArgs,
18+
processArgs: {randomize in
19+
v8ProcessArgs(randomize: randomize, forSandbox: false)
20+
},
1921

2022
// We typically fuzz without any sanitizer instrumentation, but if any sanitizers are active, "abort_on_error=1" must probably be set so that sanitizer errors can be detected.
2123
processEnv: [:],

Sources/FuzzilliCli/Profiles/V8SandboxProfile.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,7 @@ fileprivate struct SandboxFuzzingPostProcessor: FuzzingPostProcessor {
5353

5454
let v8SandboxProfile = Profile(
5555
processArgs: { randomize in
56-
var args = [
57-
"--expose-gc",
58-
"--omit-quit",
59-
"--allow-natives-syntax",
60-
"--fuzzing",
61-
"--jit-fuzzing",
62-
"--sandbox-fuzzing",
63-
// This is so that we get an ASan splat directly in the reproducer file.
64-
"--disable-in-process-stack-traces"
65-
]
66-
67-
return args
56+
v8ProcessArgs(randomize: randomize, forSandbox: true)
6857
},
6958

7059
// ASan options.

0 commit comments

Comments
 (0)