dicej requested alexcrichton for a review on PR #12153.
dicej opened PR #12153 from dicej:fix-12128 to bytecodealliance:main:
The spec says we should allow this, so now we do.
Thansk to Alex for the test case!
Fixes #12128
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
dicej requested wasmtime-core-reviewers for a review on PR #12153.
alexcrichton submitted PR review:
Code/test all look fine, but I'm trying to correlate this with the spec as well. I thought I remember that historically
may_enterwas a thing but it's no longer present inCanonicalABI.md. Can you clarify which point in the spec I should be looking at to double-check this? (and probably queue up some sort of rename/refactor to handlemay_enterto align with the spec)
Code/test all look fine, but I'm trying to correlate this with the spec as well. I thought I remember that historically
may_enterwas a thing but it's no longer present inCanonicalABI.md. Can you clarify which point in the spec I should be looking at to double-check this? (and probably queue up some sort of rename/refactor to handlemay_enterto align with the spec)Search for
trap_of_on_the_stackinCanonicalABI.mdand the prose that follows. I agree that some renaming and/or refactoring may be due.
dicej edited a comment on PR #12153:
Code/test all look fine, but I'm trying to correlate this with the spec as well. I thought I remember that historically
may_enterwas a thing but it's no longer present inCanonicalABI.md. Can you clarify which point in the spec I should be looking at to double-check this? (and probably queue up some sort of rename/refactor to handlemay_enterto align with the spec)Search for
trap_if_on_the_stackinCanonicalABI.mdand the prose that follows. I agree that some renaming and/or refactoring may be due.
I'm investigating the test failure; looks like dropping a subtask while it's yielding in an infinite loop will require some extra care.
alexcrichton commented on PR #12153:
Joel and I discussed this and the conclusion is that the
may_enterhandling in Wasmtime is outdated and no longer in sync with the spec after component-model-async refactors. Effectively we need to rebuild the reentrance check from scratch throughout Wasmtime and avoid usingmay_enterfor the triple-purpose of: preventing reentrance, requiringpost_return, and lockdown-on-trap. This'll require refactors internally to use a new component-model-async helper but will have an impact on component adapter performance as well. This all corresponds totrap_if_on_the_stackin the spec (scroll down a bit)
dicej edited a comment on PR #12153:
I'm investigating the test failure;
looks like dropping a subtask while it's yielding in an infinite loop will require some extra care.EDIT: the problem is more fundamental than that, and the refactoring Alex suggested above is going to be necessary in order to fix #12128 properly.
Last updated: Dec 13 2025 at 19:03 UTC