VirtualBox

Changeset 876 in vbox for trunk/src


Ignore:
Timestamp:
Feb 13, 2007 2:53:17 PM (18 years ago)
Author:
vboxsync
Message:

protect locked pages against fork()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r387 r876  
    724724    unsigned    cPages = pMem->cb >> PAGE_SHIFT;
    725725    unsigned long pv = (unsigned long)pMem->pvR3;
     726    struct vm_area_struct **papVMAs;
    726727
    727728    /*
     
    730731    papPages = vmalloc(cPages * sizeof(*papPages));
    731732    if (!papPages)
     733        return SUPDRV_ERR_NO_MEMORY;
     734
     735    /*
     736     * Allocate the VMA pointer array.
     737     */
     738    papVMAs = vmalloc(cPages * sizeof(*papVMAs));
     739    if (!papVMAs)
    732740        return SUPDRV_ERR_NO_MEMORY;
    733741
     
    743751                        0,                      /* force. */
    744752                        papPages,               /* Page array. */
    745                         NULL);                  /* vmas */
     753                        papVMAs);               /* vmas */
    746754    if (rc != cPages)
    747755    {
     
    759767
    760768    /*
    761      * Get addresses.
     769     * Get addresses, protect against fork()
    762770     */
    763771    for (iPage = 0; iPage < cPages; iPage++)
     
    765773        paPages[iPage].Phys = page_to_phys(papPages[iPage]);
    766774        paPages[iPage].uReserved = 0;
    767     }
     775        papVMAs[iPage]->vm_flags |= VM_DONTCOPY;
     776    }
     777
     778    vfree(papVMAs);
    768779
    769780    dprintf2(("supdrvOSLockMemOne: pvR3=%p cb=%d papPages=%p\n",
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette