VirtualBox

Ignore:
Timestamp:
Jul 7, 2009 1:13:54 AM (15 years ago)
Author:
vboxsync
Message:

tstRTR0MemUserKernel: Test that it doesn't allow kernel addresses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.cpp

    r21286 r21287  
    6464    /*
    6565     * R3Ptr is valid and good for up to a page. The page before
    66      * and after are both invalid.
     66     * and after are both invalid. Or, it's a kernel page.
    6767     */
    6868    RTR3PTR R3Ptr = (RTR3PTR)u64Arg;
     
    171171        }
    172172
     173        case TSTRTR0MEMUSERKERNEL_INVALID_ADDRESS:
     174        {
     175            if (    !RTR0MemUserIsValidAddr(R3Ptr)
     176                &&  RTR0MemKernelIsValidAddr((void *)R3Ptr))
     177            {
     178                for (unsigned off = 0; off < 16 && !*pszErr; off++)
     179                    for (unsigned cb = 0; cb < PAGE_SIZE - 16; cb++)
     180                        TEST_OFF_SIZE(off, cb, cb > 0 ? VERR_ACCESS_DENIED : VINF_SUCCESS); /* ... */
     181            }
     182            else
     183                RTStrPrintf(pszErr, cchErr, "RTR0MemUserIsValidAddr returns true");
     184            break;
     185        }
     186
    173187        default:
    174188            RTStrPrintf(pszErr, cchErr, "!Unknown test #%d", uOperation);
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