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
BEGIN EXECUTION
/tmp/helix/working/A16108B8/p/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true SwiftErrorHandling.dll ''
[createdump] Gathering state for process 61532
[createdump] Crashing thread 40c016 signal 11 (000b)
[createdump] Writing crash report to file /cores/coredump.61532.dmp.crashreport.json
[createdump] Crash report successfully written
[createdump] Writing minidump with heap to file /cores/coredump.61532.dmp
[createdump] Written 360276104 bytes (87958 pages) to core file
[createdump] Target process is alive
[createdump] Dump successfully written in 6660ms
Expected: 100
Actual: 139
END EXECUTION - FAILED
The segmentation fault stems from the JIT deciding to place the address of the Swift call into the error register; before calling a Swift method that may throw, we always have to clear the error register first. This means we end up trying to call a null address. Here's the offending snippet:
xor r12d, r12d
call r12
Seems like we need to mark the error register as busy earlier so that it's never used for the function call address.
An alternative way may be to add a SwiftError known argument that always is just constant 0. It's a bit odd, but I guess not too bad (and models nicely that actually the register's value matters). You would also be able to remove GTF_CALL_M_SWIFT_ERROR_HANDLING and switch it to a check for that well known argument.
Activity
dotnet-policy-service commentedon Mar 7, 2024
Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.
amanasifkhalid commentedon Mar 7, 2024
The segmentation fault stems from the JIT deciding to place the address of the Swift call into the error register; before calling a Swift method that may throw, we always have to clear the error register first. This means we end up trying to call a null address. Here's the offending snippet:
Seems like we need to mark the error register as busy earlier so that it's never used for the function call address.
jakobbotsch commentedon Mar 7, 2024
An alternative way may be to add a
SwiftErrorknown argument that always is just constant 0. It's a bit odd, but I guess not too bad (and models nicely that actually the register's value matters). You would also be able to removeGTF_CALL_M_SWIFT_ERROR_HANDLINGand switch it to a check for that well known argument.amanasifkhalid commentedon Mar 7, 2024
So this would behave the same way the well-known SwiftSelf arg works, right? I like that consistency; let me give it a try.
jakobbotsch commentedon Mar 7, 2024
Right.
JIT: Use sentinel arg to clear error register pre-Swift call (dotnet#…