Skip to content

Fix feature set checking for GC RMWs#8480

Merged
tlively merged 1 commit intomainfrom
gc-rmw-feature-validation
Mar 18, 2026
Merged

Fix feature set checking for GC RMWs#8480
tlively merged 1 commit intomainfrom
gc-rmw-feature-validation

Conversation

@tlively
Copy link
Member

@tlively tlively commented Mar 18, 2026

The GC RMW instructions all used the same pattern of checking whether the expected features were a subset of the expected features. Unfortunately, this pattern was wrong. It looked this this:

auto expected = FeatureSet::GC | FeatureSet::Atomics ...
shouldBeTrue(expected <= getModule()->features, ...

The problem is that the binary operator | caused the feature enums to be converted to int, so expected ended up being an int. So the <= that was supposed to be overloaded to do a subset check on the features was actually checking whether the integer values of the expected feature set was less than the enabled feature set.

This incorrect feature checking let the fuzzer use initial contents with the affected instructions without all the expected features being enabled. Later optimizations could replace these instructions with other instructions that also required shared-everything, but checked for it a different way, causing (correct but late) validation errors.

Fix the feature validation validation and remove the overloading of <= to eliminiate this class of bugs in the future.

The GC RMW instructions all used the same pattern of checking whether the expected features were a subset of the expected features. Unfortunately, this pattern was wrong. It looked this this:

```
auto expected = FeatureSet::GC | FeatureSet::Atomics ...
shouldBeTrue(expected <= getModule()->features, ...
```

The problem is that the binary operator `|` caused the feature enums to be converted to int, so `expected` ended up being an int. So the `<=` that was supposed to be overloaded to do a subset check on the features was actually checking whether the integer values of the expected feature set was less than the enabled feature set.

This incorrect feature checking let the fuzzer use initial contents with the affected instructions without all the expected features being enabled. Later optimizations could replace these instructions with other instructions that also required shared-everything, but checked for it a different way, causing (correct but late) validation errors.

Fix the feature validation validation and remove the overloading of <= to eliminiate this class of bugs in the future.
@tlively tlively requested a review from kripken March 18, 2026 00:03
@tlively tlively enabled auto-merge (squash) March 18, 2026 00:28
@tlively tlively merged commit ca7ac96 into main Mar 18, 2026
16 checks passed
@tlively tlively deleted the gc-rmw-feature-validation branch March 18, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants