Windows: handle generic executable map-view notifications#5545
Windows: handle generic executable map-view notifications#5545FrontMage wants to merge 1 commit into
Conversation
|
A good thing to discuss here is:
From FEX's point of view the only reason we care to distinguish if the mapping is a PE or not is so we can load the volatile metadata and other bits of data. If it is not a PE file, but still backed by the filesystem then we just want to know that for code caching, since we don't want to try and cache anonymous executable memory. It seems to me that currently on FEX's side, we just need to make sure our code that reads PE file data just needs to skip a bunch of work when it isn't a PE file, but researching what Windows does by tracking API calls to FEX with a test app would obviously elucidate what is necessary. |
Yes, on the Wine side my local experiment already adds the missing notification for the path I observed: after a successful non-image executable section view, Wine reuses the existing backend memory-protect callback and emits the What I have not proven yet is the Windows-native oracle for the whole chain. From the Wine side the observed path is a successful mapped-section view, effectively reaching the So I think the current FEX-side patch should still be treated as an RFC. The concrete next step is to build a small Windows test/probe that maps executable non-PE section views and compare the native Windows emulator notification behavior against the Wine path. That should answer whether FEX should handle this in |
Summary
This is a draft/RFC PR from the investigation in #5399. While debugging the WoW NoExec failure path, I found a case where Wine can report a successful executable mapped-section view that is not a PE image mapping. FEX currently routes
NotifyMapViewOfSectionthrough image-map handling, so this kind of executableMEM_MAPPEDview can miss the normal executable interval/protection tracking path.This PR contains only the FEX-side part of the experiment. I am opening it as a draft because the full behavior depends on Wine/FEX cooperation, and I would like guidance on whether this is the expected place to handle these notifications.
What changed
HandleImageMap()reject non-PE mappings instead of treating every map-view notification as an image map.InvalidationTracker->HandleMemoryProtectionNotification(...).Why
The failing path observed during #5399 had executable
MEM_MAPPEDguest pages visible to Wine/Windows state, but FEX did not have a matching executable interval for the page. In the local diagnostic build this showed up as NoExec entry-block failures, for example:With the paired Wine-side diagnostic change, Wine reports executable non-image section views through the existing backend memory-protect callback. Example diagnostic evidence from the local run:
The FEX-side change in this PR makes those generic map-view notifications update the executable/protection interval state instead of being dropped by image-only handling.
Cross-repo concern
This is the part I would like guidance on. The local fix involved both sides:
I am not sure whether this is the intended contract for
NotifyMapViewOfSection, or whether FEX would prefer a different Wine callback/ABI shape, a Wine-only change, or a different FEX-side path. Please treat this PR as a request for review of the approach rather than a final proposal.Question
What would be the preferred upstream shape for this fix: keep this FEX-side handling, move more of the responsibility to Wine, split this into coordinated Wine and FEX PRs, or use a different notification path entirely?