-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
ThunkPool doesn't work with PROCESS_MITIGATION_DYNAMIC_CODE_POLICY #113114
Comments
What exactly is the ask? We can just flip the switch on win-x64/win-arm64 today. The implementation is already there, builds and passes the smoke tests. I can probably contribute win-x86 if that's a blocker. |
|
It didn't bitrot. I tested it on win-x64 today and on win-arm64 not too long ago. I'd be in favor of enabling it by default. (We don't have working Linux implementation but it was requested in separate issue for HarmonyOS port. We also don't have the x86 version of the assembly files but that's relatively small thing to fix.) |
Turns out I was wrong and there's a bitrot after all. Specifically, the sections produced in the executable are not in the correct order. .NET Native used a custom linker script to order them in mrt100_app.dll. |
I found the old wisdom in the .NET Native tree including the undocumented link.exe argument. I'll give it a stab. |
This doesn't look fixable.
The "completely disallowed" part is not documented but per https://troopers.de/media/filer_public/f6/07/f6076037-85e0-42b7-9a51-507986edafce/the_joy_of_sandbox_mitigations_export.pdf: What Does it Disable?
(We don't care about the MapViewOfFile restriction since we don't use FILE_MAP_EXECUTE, but the I think the maximum we can do this would be to fail with a different exception than OOM. |
Reported by internal customer. When PROCESS_MITIGATION_DYNAMIC_CODE_POLICY are enabled, the VirtualProtect call we use to mark memory as Execute/Read fails with STATUS_DYNAMIC_CODE_BLOCKED that we then translate into OOM.
I guess we should investigate whether we could do !FEATURE_RX_THUNKS on Windows too.
CsWinRT is going to look into avoiding GetFunctionPointerForDelegate, but this also affects IDynamicInterfaceCastable with shared generic types (that CsWinRT is also trying to work around, but people could still hit in the past).
The text was updated successfully, but these errors were encountered: