Changeset 83087 in vbox for trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
- Timestamp:
- Feb 16, 2020 8:11:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
r83070 r83087 568 568 * in XNU's vm_fault.c code, we have to defer allocations of exec memory to 569 569 * a thread running in the kernel_task to get consistent results here. 570 * Believing is trouble is caused by the page_nx() + exec check, it was 571 * introduced in 10.10.5 (or 10.11.0). 572 * (PS. Doubt this is in anyway intentional behaviour, but rather unforseen 573 * consequences from a pragmatic approach to modifying the complicate VM code.) 570 * 571 * Trouble strikes in vm_fault_enter() when cs_enforcement_enabled is determined 572 * to be true because current process has the CS_ENFORCEMENT flag, the page flag 573 * vmp_cs_validated is clear, and the protection mask includes VM_PROT_EXECUTE 574 * (pmap_cs_enforced does not apply to macOS it seems). This test seems to go 575 * back to 10.5, though I'm not sure whether it's enabled for macOS that early 576 * on. Only VM_PROT_EXECUTE is problematic for kernel memory, (though 577 * VM_PROT_WRITE on code signed pages is also problematic in theory). As long as 578 * kernel_task doesn't have CS_ENFORCEMENT enabled, we'll be fine switching to it. 574 579 */ 575 580 if (!fExecutable || fOnKernelThread) … … 1432 1437 * in has CS restrictions active, we cannot play around with the EXEC 1433 1438 * protection because some vm_fault.c think we're modifying the process map 1434 * or something. Looks like this problem was introduced in 10.10.5 or/and 1435 * 10.11.0, so for for Yosemite and up we'll just push the work off to a thread 1436 * running in the kernel_task context and hope it has be better chance of 1437 * consistent results. 1439 * or something. 1438 1440 */ 1439 1441 int rc; 1440 if ( version_major >= 14 /* 10.10 = Yosemite */ 1441 && rtR0MemObjDarwinGetMap(pMem) == kernel_map) 1442 if (rtR0MemObjDarwinGetMap(pMem) == kernel_map) 1442 1443 { 1443 1444 RTR0MEMOBJDARWINPROTECTARGS Args;
Note:
See TracChangeset
for help on using the changeset viewer.