Skip to content

Conversation

@khagankhan
Copy link
Contributor

@khagankhan khagankhan commented Aug 7, 2025

  • Decoupled TableOps and TableOpsLimits, which are now passed explicitly to TableOp::fixup
  • Updated the macro to align with the new struct separation
  • TableOps::fixup now processes the entire sequence of operations instead of starting from specific index

I placed clamping logic at the beginning of the to_wasm_binary method since the OOM issues originate in to_wasm_binary This relies on TableOp::fixup to ensure that values respect those clamped limits to avoid potential traps.

I previously added clamping at the start of TableOps::fixup but the OOM still occurred there.

I let it fuzz for a while, and it ran fine but I sense something might be missing.

Related Issues: #11345 and #11346

@khagankhan khagankhan requested a review from a team as a code owner August 7, 2025 05:47
@khagankhan khagankhan requested review from fitzgen and removed request for a team August 7, 2025 05:47
@github-actions github-actions bot added the fuzzing Issues related to our fuzzing infrastructure label Aug 7, 2025
@github-actions
Copy link

github-actions bot commented Aug 7, 2025

Subscribe to Label Action

cc @fitzgen

This issue or pull request has been labeled: "fuzzing"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: fuzzing

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with the nitpick about println! below addressed.

I think we should also switch to calling fixup at the start of to_wasm_binary instead of after each particular mutation, since it has to process all ops and can't take advantage of our knowledge of which mutation we performed and where that mutation was anymore. This change will cut down on the number of call sites and also make it more obvious that the clamping in to_wasm_binary won't ever produce invalid Wasm binaries. (With this PR now, I think we could produce invalid Wasm binaries from to_wasm_binary's clamping due to deserializing some ops that haven't been fixup'd to work with the clamping yet.) This can happen in a follow up PR if you'd prefer.

Thanks!

let wasm = res.to_wasm_binary();
let mut validator = Validator::new();
let wat = wasmprinter::print_bytes(&wasm).expect("[-] Failed .print_bytes(&wasm).");
println!("{wat}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be log::debug! and not a println!.

@khagankhan
Copy link
Contributor Author

Thanks! Yes that makes sense. Initially, I did that. Calling fixup in to_wasm_binary(). It hit assertion failure at for limit > 0. I guess after addressing it we can do that. I will make another PR where clamping happen at the beginning of fixup and fixup is called in encoding.

I forgot to remove println! :/

@fitzgen fitzgen added this pull request to the merge queue Aug 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 7, 2025
@khagankhan
Copy link
Contributor Author

I was not merged. @fitzgen do you know why this may happen 🤔?

@fitzgen
Copy link
Member

fitzgen commented Aug 20, 2025

It looks like CI failed, you can see this via the "view details" button next to the "github-merge-queue bot removed this pull request from the merge queue due to failed status checks" notification.

In particular, this job failed: https://github.com/bytecodealliance/wasmtime/actions/runs/16817124055/job/47636482289

It looks like it is old enough that the logs were deleted however, so I will try re-enqueing this PR and if it fails again, you can see the failure via the method described above.

@fitzgen fitzgen added this pull request to the merge queue Aug 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2025
@fitzgen
Copy link
Member

fitzgen commented Aug 20, 2025

This failure looks like some spurious networking issue involving docker or something. Retrying once more.

@fitzgen fitzgen added this pull request to the merge queue Aug 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2025
@fitzgen
Copy link
Member

fitzgen commented Aug 20, 2025

Looks like this time there was an internal assertion inside the macos linker?? Retrying once more...

@fitzgen fitzgen added this pull request to the merge queue Aug 20, 2025
@khagankhan
Copy link
Contributor Author

Thanks!🤞

Merged via the queue into bytecodealliance:main with commit bb7ec8e Aug 20, 2025
44 checks passed
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
* Fix Out-of-memory in table-ops

* Remove missed println!

---------

Co-authored-by: Khagan Karimov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzing Issues related to our fuzzing infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants