[wasm][coreclr] Fix prestub of methods with IL helper stubs#124873
[wasm][coreclr] Fix prestub of methods with IL helper stubs#124873radekdoulik wants to merge 3 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @agocke |
There was a problem hiding this comment.
Pull request overview
This PR fixes a WASM/CoreCLR interpreter prestub issue where methods implemented via managed IL helper stubs could end up publishing an entrypoint that maps to the helper MethodDesc, breaking MethodDesc lookups and access checks (manifesting as MethodAccessException, e.g. around delegate construction).
Changes:
- Update
MethodDesc::DoPrestub(FCall + managed-impl + portable entrypoints) to publish this method’s ownPortableEntryPointand attach interpreter data to it, instead of reusing the helper’s portable entrypoint. - Enable interpreter callsite access-check callouts on WASM by removing the
#ifndef TARGET_WASMguard.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/coreclr/vm/prestub.cpp |
Publishes the current method’s portable entrypoint and sets interpreter data for managed FCall helper-stub scenarios. |
src/coreclr/interpreter/compiler.cpp |
Enables emitting callsite access-check callouts on WASM by removing a WASM-only compile-time exclusion. |
| @@ -2315,6 +2315,18 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT, CallerGCMode callerGCMo | |||
| (void)helperMD->DoPrestub(NULL /* MethodTable */, CallerGCMode::Coop); | |||
| void* ilStubInterpData = helperMD->GetInterpreterCode(); | |||
| SetInterpreterCode((InterpByteCodeStart*)ilStubInterpData); | |||
There was a problem hiding this comment.
Can this line be inside if (ilStubInterpData != NULL) as well?
There was a problem hiding this comment.
I think we can add an assert before this line and do the rest unconditionally.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Fix #121955