Skip to content

Testing #16563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

Testing #16563

wants to merge 9 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Oct 23, 2024

No description provided.

cmb69 added 3 commits October 23, 2024 22:20
This reverts commit e4983709136f73fcb58437f1469a46f0acd6370d.
@cmb69
Copy link
Member Author

cmb69 commented Oct 23, 2024

The first attempt is based on observations from https://blog.lazym.io/2020/09/21/Unicorn-Devblog-setjmp-longjmp-on-Windows/. Since I haven't been able to patch setjmp(), I've patched longjpm(). Now a lot of tests are failing (bad) with STATUS_FAIL_FAST_EXCEPTION (maybe not so bad).

The second attempt builds with /GS-, but this time without any external dependency libraries (these may not use this setting, and might be the reasons for the STATUS_FAIL_FAST_EXCEPTION issues).

@nielsdos
Copy link
Member

nielsdos commented Oct 23, 2024

FWIW I think the issue is indeed SEH; I've had the same idea to disable SEH unwinding, but probably did something wrong: nielsdos#118
EDIT: please ignore me, I just get the same exception you already mentioned

@cmb69
Copy link
Member Author

cmb69 commented Oct 23, 2024

I think this is indeed related to RtlUnwindEx(); the STATUS_FAIL_FAST_EXCEPTIONs might come from some C++ code (possibly intl/ICU). So even if this can be solved by working around RtlUnwindEx(), that wouldn't be a proper solution (would skip destructors). I guess it's finally something to fix in the JIT code generation. But I wouldn't even have an idea where to start looking there.

@cmb69
Copy link
Member Author

cmb69 commented Oct 23, 2024

@nielsdos
Copy link
Member

The JIT is supposed to follow the Winx64 calling convention, so it may be worth checking the generated code to see if something in there is wrong. It could even be very subtle like alignment etc

@nielsdos
Copy link
Member

Or we're supposed to emit some exception-related data structures is what you're saying?

@cmb69
Copy link
Member Author

cmb69 commented Oct 23, 2024

Or we're supposed to emit some exception-related data structures is what you're saying?

Yes, I think so. https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64 says:

For dynamically generated functions [JIT compilers], the runtime to support these functions must either use RtlInstallFunctionTableCallback or RtlAddFunctionTable to provide this information to the operating system. Failure to do so will result in unreliable exception handling and debugging of processes.

Anyhow, /GS- got rid of the STATUS_BAD_STACK, but not the STATUS_BAD_FUNCTION_TABLE and now we see some segfaults, too.

cmb69 added 2 commits October 23, 2024 23:28
This reverts commit ab1f65d.
This reverts commit f82ddcc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants