You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WASM handling of optimized stackalloc is incorrect #131557
Priority:1Work that is critical for the release, but we could probably ship withoutarch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
When compiling the checked System.Private.CoreLib, the Interop.Sys.GetCwd() method has a stackalloc which is improperly handled. Notably, after it does the stackalloc, calls to the Interop.Sys.GetCwd(byte* buffer, int bufferLength) and other functions do not actually call the method with the updated stack pointer, instead they use the stack pointer computed in the prolog. This causes memory corruption in the subsequent logic which converts the result into a System.String object.
Reproduction Steps
This is known to repro in the checked build of System.Private.CoreLib.
Expected behavior
After stackallocating, all subsequent calls should pass the updated stack pointer down.
Actual behavior
Stack pointer in called functions is in the middle of the GetCwd stack frame, causing memory corruption.
Priority:1Work that is critical for the release, but we could probably ship withoutarch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Activity
dotnet-policy-service commentedon Jul 29, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
davidwrighton commentedon Jul 29, 2026
AndyAyersMS commentedon Jul 29, 2026
Looks like we need to force the stackalloc eval earlier, if the stackalloc is a call arg, otherwise we will push the old SP, not the new SP.
dotnet-policy-service commentedon Jul 30, 2026
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.
JIT: evaluate wasm localloc call args to temps (#131559)