Skip to content

Windows x86 Checked CLR build using -O2 hits runtime asserts #59845

@BruceForstall

Description

@BruceForstall

See #53888

Note that Windows Checked is currently built using the -O1 compiler switch.

E.g.,

Assert failure(PID 7704 [0x00001e18], Thread: 7708 [0x1e1c]): FastNExportSEH(pEHR) || IsComPlusNestedExceptionRecord(pEHR) || ((ExecuteHandler2Module != NULL) && IsIPInModule(ExecuteHandler2Module, (PCODE)pEHR->Handler))

CORECLR! PopNestedExceptionRecords + 0xA0 (0x71127c40)
CORECLR! COMPlusEndCatch + 0x4A (0x711285da)
CORECLR! JIT_EndCatch + 0xE (0x71199e41)
CORECLR! CallDescrWorkerInternal + 0x34 (0x71199121)
CORECLR! CallDescrWorker + 0x13E (0x70da52ee)
CORECLR! CallDescrWorkerWithHandler + 0x189 (0x70da5589)
CORECLR! MethodDescCallSite::CallTargetWorker + 0x7A7 (0x70da5d77)
CORECLR! RunMainInternal + 0x2FE (0x70ae232e)
CORECLR! ``RunMain'::29'::__Body::Run'::5'::__Body::Run + 0x86 (0x70ae1c36)
CORECLR! RunMain'::29'::__Body::Run + 0xA3 (0x70ae1d53)
File: D:\workspace_work\1\s\src\coreclr\vm\i386\excepx86.cpp Line: 2054
Image: C:\h\w\B10F09DA\p\corerun.exe

and:

Assert failure(PID 3932 [0x00000f5c], Thread: 5880 [0x16f8]): Consistency check failed: Invalid transition into managed code!

We're walking this thread's stack and we've reached a managed frame at Esp=0x00F7D338. (The method is EHTest::f1) The very next FS:0 record (0x00F7D460) up from this point on the stack should be one of our 'unmanaged to managed SEH handlers', but its not... its something else, and that's very bad. It indicates that someone managed to call into managed code without setting up the proper exception handling.

Get a good unmanaged stack trace for this thread. All FS:0 records are on the stack, so you can see who installed the last handler. Somewhere between that function and where the thread is now is where the bad transition occurred.

A little extra info: FS:0 = 0x00F7C35C, pEHR->Handler = 0x70D12C3A
FAILED: IsUnmanagedToManagedSEHHandler(pEHR)

CORECLR! CHECK::Trigger + 0x3C4 (0x70a75264)
CORECLR! VerifyValidTransitionFromManagedCode + 0x18A (0x709e856a)
CORECLR! StackFrameIterator::NextRaw + 0xAE4 (0x705ca434)
CORECLR! Thread::StackWalkFramesEx + 0x421 (0x705cb681)
CORECLR! Thread::StackWalkFrames + 0x159 (0x705cb1c9)
CORECLR! LookForHandler + 0x1A (0x704959da)
CORECLR! CPFH_RealFirstPassHandler + 0xF57 (0x709e6007)
CORECLR! CPFH_FirstPassHandler + 0x1C0 (0x709e5020)
CORECLR! COMPlusFrameHandler + 0x26B (0x709e88db)
CORECLR! COMPlusNestedExceptionHandler + 0x13B (0x709e8a6b)
File: D:\workspace_work\1\s\src\coreclr\vm\i386\excepx86.cpp Line: 329
Image: C:\h\w\B10F09DA\p\corerun.exe

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions