VirtualBox

Changeset 52033 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 15, 2014 9:23:37 AM (11 years ago)
Author:
vboxsync
Message:

IPRT/memsafer: Relax the guarding pages protection, some hosts like Linux and Windows don't support SUPR3PageProtect

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/memsafer-generic.cpp

    r52020 r52033  
    116116 *
    117117 * @note: The allocation will have an extra page allocated before and after the
    118  *        user area with all access rights removed to prevent heartbleed like
    119  *        attacks.
     118 *        user area with all access rights removed if the host supports that to
     119 *        prevent heartbleed like attacks.
    120120 */
    121121static int rtMemSaferSupR3Alloc(void **ppvNew, size_t cb)
     
    132132    if (RT_SUCCESS(rc))
    133133    {
    134         /* Change the memory protection of the pages guarding the allocation. */
     134        /*
     135         * Change the memory protection of the pages guarding the allocation.
     136         * Some hosts don't support changing the page protection, ignore these
     137         * errors.
     138         */
    135139        rc = SUPR3PageProtect(pvNew, NIL_RTR0PTR, 0, PAGE_SIZE, RTMEM_PROT_NONE);
    136         if (RT_SUCCESS(rc))
     140        if (RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED)
    137141        {
    138             Assert(cb == (size_t)((uint32_t)(PAGE_SIZE + cbUser)));
    139             rc = SUPR3PageProtect(pvNew, NIL_RTR0PTR, PAGE_SIZE + (uint32_t)cbUser, PAGE_SIZE, RTMEM_PROT_NONE);
     142            Assert(PAGE_SIZE + cbUser == (size_t)((uint32_t)(PAGE_SIZE + cbUser)));
     143            if (rc == VERR_NOT_SUPPORTED)
     144                rc = VINF_SUCCESS;
     145            else
     146                rc = SUPR3PageProtect(pvNew, NIL_RTR0PTR, PAGE_SIZE + (uint32_t)cbUser, PAGE_SIZE, RTMEM_PROT_NONE);
     147
    140148            if (RT_SUCCESS(rc))
    141149            {
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