Skip to content

[jitstressregs] Interop/Swift/SwiftErrorHandling/SwiftErrorHandling fails #99414

Closed

Description

@jakobbotsch

Example run: https://dev.azure.com/dnceng-public/public/_build/results?buildId=588357&view=results
Console log: https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-99093-merge-3e961c67e325430c8b/Interop/1/console.dcc96f17.log?helixlogtype=result

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

FYI @amanasifkhalid cc @dotnet/jit-contrib

Activity

  1. added
    area-CodeGen-coreclr
    and removed on Mar 7, 2024
  2. added this to the 9.0.0 milestone on Mar 7, 2024
  3. dotnet-policy-service commented on Mar 7, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @tommcdon
    See info in area-owners.md if you want to be subscribed.

  4. amanasifkhalid commented on Mar 7, 2024

    @amanasifkhalid
    Contributor

    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.

  5. jakobbotsch commented on Mar 7, 2024

    @jakobbotsch
    MemberAuthor

    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.

  6. amanasifkhalid commented on Mar 7, 2024

    @amanasifkhalid
    Contributor

    An alternative way may be to add a SwiftError known argument that always is just constant 0

    So this would behave the same way the well-known SwiftSelf arg works, right? I like that consistency; let me give it a try.

  7. jakobbotsch commented on Mar 7, 2024

    @jakobbotsch
    MemberAuthor

    So this would behave the same way the well-known SwiftSelf arg works, right?

    Right.

  8. added a commit that references this issue on Mar 8, 2024
    4c94de4
  9. locked and limited conversation to collaborators on Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions