Skip to content

Testing - #16563

Closed
cmb69 wants to merge 9 commits into
php:masterfrom
cmb69:cmb/gh15709
Closed

Testing#16563
cmb69 wants to merge 9 commits into
php:masterfrom
cmb69:cmb/gh15709

Conversation

@cmb69

@cmb69 cmb69 commented Oct 23, 2024

Copy link
Copy Markdown
Member

No description provided.

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

cmb69 commented Oct 23, 2024

Copy link
Copy Markdown
Member Author

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).

@ndossche

ndossche commented Oct 23, 2024 •

Copy link
Copy Markdown
Member

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

@cmb69

cmb69 commented Oct 23, 2024

Copy link
Copy Markdown
Member Author

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

cmb69 commented Oct 23, 2024

Copy link
Copy Markdown
Member Author

@ndossche

Copy link
Copy Markdown
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

@ndossche

Copy link
Copy Markdown
Member

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

@cmb69

cmb69 commented Oct 23, 2024

Copy link
Copy Markdown
Member Author

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