On Fri Oct 3 17:02:49 2025 +0000, Tim Clem wrote:
Have you confirmed that the protection from these `vm_region_info_t`s is accurate under Rosetta? I seem to remember it reporting the actual underlying page protection that Mach is using, which in the case of wx pages might be different than how it acts - or was allocated - under Rosetta (since w|x isn't supported in native ARM and is emulated by Rosetta by handling the exceptions). So for instance for a MEM_WRITE_WATCH page with PAGE_EXECUTE_READWRITE protections, I imagine the assert below might fail.
IMO the major problem here is that while it greatly optimizes one part (access to watched pages) it at the same time greatly degrades the performance of watch query / reset part (and the latter is probably not savable within the API limitation; even if the query part could be made over bigger regions the rest part must still only reset the detected-dirty pages, or it will be missing dirty state with concurrent access). Which may of course still help some usage patterns but regress others. So the main question is whether this tradeoff is overall beneficial?