Changeset 4725 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Sep 12, 2007 10:12:31 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
r4671 r4725 61 61 bool fAllocatedPagesForMdl; 62 62 #endif 63 /** Pointer returned by MmSecureVirtualMemory */ 64 PVOID pvSecureMem; 63 65 /** The number of PMDLs (memory descriptor lists) in the array. */ 64 66 uint32_t cMdls; … … 84 86 MmUnmapLockedPages(pMemNt->Core.pv, pMemNt->apMdls[0]); 85 87 pMemNt->Core.pv = NULL; 88 if (pMemNt->pvSecureMem) 89 { 90 MmUnsecureVirtualMemory(pMemNt->pvSecureMem); 91 pMemNt->pvSecureMem = NULL; 92 } 86 93 87 94 MmFreePagesFromMdl(pMemNt->apMdls[0]); … … 133 140 134 141 case RTR0MEMOBJTYPE_LOCK: 142 if (pMemNt->pvSecureMem) 143 { 144 MmUnsecureVirtualMemory(pMemNt->pvSecureMem); 145 pMemNt->pvSecureMem = NULL; 146 } 135 147 for (uint32_t i = 0; i < pMemNt->cMdls; i++) 136 148 { … … 523 535 { 524 536 MmProbeAndLockPages(pMdl, R0Process == NIL_RTR0PROCESS ? KernelMode : UserMode, IoModifyAccess); 537 525 538 pMemNt->apMdls[iMdl] = pMdl; 526 539 pMemNt->cMdls++; … … 531 544 rc = VERR_LOCK_FAILED; 532 545 break; 546 } 547 548 if (R0Process != NIL_RTR0PROCESS ) 549 { 550 /* Make sure the user process can't change the allocation. */ 551 pMemNt->pvSecureMem = MmSecureVirtualMemory(pv, cb, PAGE_READWRITE); 552 if (!pMemNt->pvSecureMem) 553 { 554 rc = VERR_NO_MEMORY; 555 break; 556 } 533 557 } 534 558 … … 554 578 pMemNt->apMdls[iMdl] = NULL; 555 579 } 580 if (pMemNt->pvSecureMem) 581 { 582 MmUnsecureVirtualMemory(pMemNt->pvSecureMem); 583 pMemNt->pvSecureMem = NULL; 584 } 585 556 586 rtR0MemObjDelete(&pMemNt->Core); 557 return VERR_LOCK_FAILED;587 return rc; 558 588 } 559 589 … … 661 691 rc = VERR_MAP_FAILED; 662 692 } 693 663 694 } 664 695 else
Note:
See TracChangeset
for help on using the changeset viewer.