Skip to content

Commit 0db418a

Browse files
authored
[Fuzzing] Simplify V8 fuzzing flags: use --fuzzing over specific EH flag (#7509)
ClusterFuzz already applies this flag, and it implies the EH flag, so we might as well do it the way V8 does it. This is simpler, though it does mean we are testing something even more different than production - but in the way V8 believes is best for fuzzing, at least.
1 parent cfb9ff1 commit 0db418a

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

scripts/clusterfuzz/run.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333

3434
# The V8 flags we put in the "fuzzer flags" files, which tell ClusterFuzz how to
3535
# run V8. By default we apply all staging flags.
36-
#
37-
# We also allow mixed EH, see the comment on the same flag in fuzz_opt.py
38-
FUZZER_FLAGS_FILE_CONTENTS = '--wasm-staging --wasm-allow-mixed-eh-for-testing'
36+
FUZZER_FLAGS_FILE_CONTENTS = '--wasm-staging'
3937

4038
# Maximum size of the random data that we feed into wasm-opt -ttf. This is
4139
# smaller than fuzz_opt.py's INPUT_SIZE_MAX because that script is tuned for

scripts/fuzz_opt.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -670,15 +670,10 @@ def run_bynterp(wasm, args):
670670
# Enable even more things than V8_OPTS. V8_OPTS are the flags we want to use
671671
# when testing, on our fixed test suite, but when fuzzing we may want more.
672672
def get_v8_extra_flags():
673-
# Due to https://github.com/WebAssembly/exception-handling/issues/344 , VMs
674-
# do not allow mixed old and new wasm EH. Our fuzzer will very frequently
675-
# mix those instructions in a module, so we must use the flag to allow that.
676-
# FIXME This is not great, as the majority of the wasm files we test on are
677-
# not actually valid in VMs. But we get coverage this way for runtime
678-
# linking of old and new EH (which VMs allow), that is, our compile-
679-
# time combination of old and new simulates runtime linking to some
680-
# extent.
681-
flags = ['--wasm-allow-mixed-eh-for-testing']
673+
# It is important to use the --fuzzing flag because it does things like
674+
# enable mixed old and new EH (which is an issue since
675+
# https://github.com/WebAssembly/exception-handling/issues/344 )
676+
flags = ['--fuzzing']
682677

683678
# Sometimes add --future, which may enable new JITs and such, which is good
684679
# to fuzz for V8's sake.
@@ -1663,6 +1658,10 @@ def handle(self, wasm):
16631658
with open(flags_file, 'r') as f:
16641659
flags = f.read()
16651660
cmd += flags.split(' ')
1661+
# Get V8's extra fuzzing flags, the same as the ClusterFuzz runner does
1662+
# (as can be seen from the testcases having --fuzzing and a lot of other
1663+
# flags as well).
1664+
cmd += get_v8_extra_flags()
16661665
# Run the fuzz file, which contains a modified fuzz_shell.js - we do
16671666
# *not* run fuzz_shell.js normally.
16681667
cmd.append(os.path.abspath(fuzz_file))

test/unit/test_cluster_fuzz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_file_contents(self):
186186

187187
# The flags file must contain --wasm-staging
188188
with open(flags_file) as f:
189-
self.assertEqual(f.read(), '--wasm-staging --wasm-allow-mixed-eh-for-testing')
189+
self.assertEqual(f.read(), '--wasm-staging')
190190

191191
# Extract the wasm file(s) from the JS. Make sure to not notice
192192
# stale files.

0 commit comments

Comments
 (0)