VirtualBox

Changeset 97874 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 27, 2022 10:07:39 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154964
Message:

IPRT/tstLdr-4: Switch from RTMemExecAlloc to RTMemPageAlloc + RTMemProtect as the RTMemExecAlloc is being removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstLdr-4.cpp

    r96407 r97874  
    238238
    239239        /* Allocate bits. */
    240         aLoads[i].pvBits = RTMemExecAlloc(cb);
     240        aLoads[i].pvBits = RTMemPageAlloc(cb);
    241241        if (!aLoads[i].pvBits)
    242242        {
    243243            RTTestIFailed("Out of memory '%s'/%d cbImage=%d. aborting test.", pszFilename, i, cbImage);
     244            break;
     245        }
     246        rc = RTMemProtect(aLoads[i].pvBits, cb, RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC);
     247        if (RT_FAILURE(rc))
     248        {
     249            RTTestIFailed("RTMemProtect/RWX '%s'/%d cbImage=%d, %Rrc. aborting test.", pszFilename, i, cbImage, rc);
    244250            break;
    245251        }
     
    311317    {
    312318        if (aLoads[i].pvBits)
    313             RTMemExecFree(aLoads[i].pvBits, aLoads[i].cbBits);
     319        {
     320            RTMemProtect(aLoads[i].pvBits, aLoads[i].cbBits, RTMEM_PROT_READ | RTMEM_PROT_WRITE);
     321            RTMemPageFree(aLoads[i].pvBits, aLoads[i].cbBits);
     322        }
    314323        if (aLoads[i].hLdrMod)
    315324        {
Note: See TracChangeset for help on using the changeset viewer.

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