VirtualBox

Changeset 71602 in vbox


Ignore:
Timestamp:
Apr 1, 2018 4:44:41 PM (6 years ago)
Author:
vboxsync
Message:

iprt/cdefs.h: Introduced a couple of more macros for paranoid handling untrusted data.

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/Graphics/VBoxVideo.h

    r71596 r71602  
    13911391    VBOXVDMA_CTL_TYPE_DISABLE,
    13921392    VBOXVDMA_CTL_TYPE_FLUSH,
    1393     VBOXVDMA_CTL_TYPE_WATCHDOG
     1393    VBOXVDMA_CTL_TYPE_WATCHDOG,
     1394    VBOXVDMA_CTL_TYPE_END
    13941395} VBOXVDMA_CTL_TYPE;
    13951396
  • trunk/include/iprt/cdefs.h

    r71589 r71602  
    15831583 * This is more than just documentation as it specifies the 'volatile' keyword,
    15841584 * because the guest could modify the data at any time. */
    1585 #define RT_UNTRUSTED_VOLATILE_USER      volatile
     1585#define RT_UNTRUSTED_VOLATILE_USER              volatile
    15861586
    15871587/** @def RT_UNTRUSTED_GUEST
     
    15931593 * This is more than just documentation as it specifies the 'volatile' keyword,
    15941594 * because the guest could modify the data at any time. */
    1595 #define RT_UNTRUSTED_VOLATILE_GUEST     volatile
     1595#define RT_UNTRUSTED_VOLATILE_GUEST             volatile
    15961596
    15971597/** @def RT_UNTRUSTED_HOST
     
    16031603 * This is more than just documentation as it specifies the 'volatile' keyword,
    16041604 * because the host could modify the data at any time. */
    1605 #define RT_UNTRUSTED_VOLATILE_HOST      volatile
     1605#define RT_UNTRUSTED_VOLATILE_HOST              volatile
    16061606
    16071607/** @def RT_UNTRUSTED_HSTGST
     
    16131613 * This is more than just documentation as it specifies the 'volatile' keyword,
    16141614 * because the host could modify the data at any time. */
    1615 #define RT_UNTRUSTED_VOLATILE_HSTGST    volatile
     1615#define RT_UNTRUSTED_VOLATILE_HSTGST            volatile
     1616/** @} */
     1617
     1618/** @name Fences for use when handling untrusted data.
     1619 * @{ */
     1620/** For use after copying untruated volatile data to a non-volatile location.
     1621 * This translates to a compiler memory barrier and will help ensure that the
     1622 * compiler uses the non-volatile copy of the data. */
     1623#define RT_UNTRUSTED_NONVOLATILE_COPY_FENCE()   ASMCompilerBarrier()
     1624/** For use after finished validating guest input.
     1625 * What this translates to is architecture dependent.  On intel it will
     1626 * translate to a CPU load+store fence as well as a compiler memory barrier. */
     1627#if   defined(RT_ARCH_AMD64)
     1628# define RT_UNTRUSTED_VALIDATED_FENCE()         do { ASMCompilerBarrier(); ASMMemoryFenceSSE2(); } while (0)
     1629#elif defined(RT_ARCH_X86)
     1630# define RT_UNTRUSTED_VALIDATED_FENCE()         do { ASMCompilerBarrier(); ASMMemoryFence(); } while (0)
     1631#else
     1632# define RT_UNTRUSTED_VALIDATED_FENCE()         do { ASMCompilerBarrier(); } while (0)
     1633#endif
    16161634/** @} */
    16171635
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