Skip to content

Commit

Permalink
[threads] Fuzz shared types in type fuzzer (WebAssembly#6704)
Browse files Browse the repository at this point in the history
Give the type fuzzer the ability to generate shared heap types when the
shared-everything feature is enabled. It correctly ensures that shared
structs and arrays cannot reference unshared heap types, but that
unshared heap types can reference any heap type.

Update the main fuzzer so that for the time being it never uses the
shared-everything feature when generating additional heap types, so it
never generates shared types. We can lift this restriction once the main
fuzzer has been updated to properly handle shared types.

As a drive-by, fix some logic for subtracting feature sets from each
other that is used in this commit.
  • Loading branch information
tlively committed Jun 26, 2024
1 parent d6b4f01 commit ff8095d
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 144 deletions.
5 changes: 4 additions & 1 deletion src/tools/fuzzing/fuzzing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,11 @@ void TranslateToFuzzReader::setupHeapTypes() {

// For GC, also generate random types.
if (wasm.features.hasGC()) {
// Do not generate shared types until the fuzzer can be updated to handle
// them.
auto features = wasm.features - FeatureSet::SharedEverything;
auto generator =
HeapTypeGenerator::create(random, wasm.features, upTo(MAX_NEW_GC_TYPES));
HeapTypeGenerator::create(random, features, upTo(MAX_NEW_GC_TYPES));
auto result = generator.builder.build();
if (auto* err = result.getError()) {
Fatal() << "Failed to build heap types: " << err->reason << " at index "
Expand Down
Loading

0 comments on commit ff8095d

Please sign in to comment.