Skip to content

wasm2c: allow embedder to configure elimination of dead OOB reads - #2826

Open
shravanrn wants to merge 1 commit into
WebAssembly:mainfrom
UT-Security:noforceread
Open

wasm2c: allow embedder to configure elimination of dead OOB reads#2826
shravanrn wants to merge 1 commit into
WebAssembly:mainfrom
UT-Security:noforceread

Conversation

@shravanrn

@shravanrn shravanrn commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

This PR also allows the embedder to disable force_reads (this is off by default, since it is non conforming), as it speeds up several sandboxing workloads by a large amount

  • Sandboxed XML parsing with libExpat by 5%
  • Sandboxed Audio speed adjustment with libSoundTouch by 10%

While the force read preserves Wasm's determinism guarantees, it clearly comes at a large cost. This cost is not worth for embedders that care only about security and not the determinism guarantees. These are both libraries that Firefox currently sandboxes, and thus this is a feature that I definitely want to land and use.

wasm2c would not be the first compiler to add the option for this feature. Currently Wamr and aWsm enable this by default and don't have a way to disable it, while Wasmer enables it by default and has a switch to disable it. I think wasm2c should remain conformant and not go that far, but it can provide an off-by-default option for this.

Additionally, the actual feature is only about 5 lines so is easy enough to maintain.

@shravanrn

Copy link
Copy Markdown
Collaborator Author

@sbc100 I have split out the change as requested. As noted above, this is a change I definitely want to land and use soon due to the performance implications.

@shravanrn
shravanrn force-pushed the noforceread branch 2 times, most recently from 4bcb340 to cebcc4e Compare August 17, 2026 00:10
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.

1 participant