VirtualBox

Changeset 100220 in vbox for trunk


Ignore:
Timestamp:
Jun 19, 2023 7:14:10 PM (18 months ago)
Author:
vboxsync
Message:

HostServices/SharedFolders/vbsf.cpp: Don't use the host page size when dealing with guest memory but use the VMMDEV_PAGE_* macros, fixes data corruption during reads and writes, bugref:10456

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r99802 r100220  
    4242#include <VBox/AssertGuest.h>
    4343#include <VBox/param.h>
     44#include <VBox/VMMDev.h>
    4445#include <iprt/alloc.h>
    4546#include <iprt/assert.h>
     
    12291230            Assert(iPage < pPages->cPages);
    12301231
     1232            /** @todo r=aeichner This was just using PAGE_SIZE before which doesn't work if the host and guest use different
     1233             * page sizes (think of 16KiB on macOS.arm64 vs linux.arm64) causing data corruption, yay! VMMDev now imposes a page size of 4KiB and
     1234             * VBOXHGCMSVCPARMPAGES should really have a cbPage member to indicate the used page size instead of dragging
     1235             * in VMMDev.h here. OTOH the size of VBOXHGCMSVCPARMPAGES can be part of a saved state which would mean increasing
     1236             * the HGCM saved state version... */
     1237
    12311238            /* Current page. */
    12321239            void *pvSeg;
    12331240            paSegs[iSeg].pvSeg = pvSeg = pPages->papvPages[iPage];
    1234             uint32_t cbSeg = PAGE_SIZE - (uint32_t)((uintptr_t)pvSeg & PAGE_OFFSET_MASK);
     1241            uint32_t cbSeg = VMMDEV_PAGE_SIZE - (uint32_t)((uintptr_t)pvSeg & VMMDEV_PAGE_OFFSET_MASK);
    12351242            iPage++;
    12361243
     
    12401247            {
    12411248                iPage++;
    1242                 cbSeg += PAGE_SIZE;
     1249                cbSeg += VMMDEV_PAGE_SIZE;
    12431250            }
    12441251
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