VirtualBox

Changeset 70873 in vbox for trunk/include


Ignore:
Timestamp:
Feb 5, 2018 6:13:55 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120699
Message:

VMMDev,VBoxGuest: Classify who is calling the host (part 1). bugref:9105

Location:
trunk/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuestCoreTypes.h

    r68688 r70873  
    6464     * output size. */
    6565    uint32_t        cbOut;
    66     /** Reserved, MBZ. */
     66    /** Reserved / filled in by kernel, MBZ.
     67     * @sa VMMDevRequestHeader::fRequestor */
    6768    uint32_t        uReserved;
    6869} VBGLREQHDR;
  • trunk/include/VBox/VBoxGuestLib.h

    r69107 r70873  
    229229 *
    230230 * @param   pLoc                The service to connect to.
     231 * @param   fRequestor          VMMDEV_REQUESTOR_XXX.
    231232 * @param   pidClient           Where to return the client ID on success.
    232233 * @param   pfnAsyncCallback    Required pointer to function that is calledwhen
     
    238239 * @return  VBox status code.
    239240 */
    240 DECLR0VBGL(int) VbglR0HGCMInternalConnect(HGCMServiceLocation const *pLoc, HGCMCLIENTID *pidClient,
     241DECLR0VBGL(int) VbglR0HGCMInternalConnect(HGCMServiceLocation const *pLoc, uint32_t fRequestor, HGCMCLIENTID *pidClient,
    241242                                          PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
    242243
     
    250251 *
    251252 * @param   idClient            The client ID to disconnect.
     253 * @param   fRequestor          VMMDEV_REQUESTOR_XXX.
    252254 * @param   pfnAsyncCallback    Required pointer to function that is called when
    253255 *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
     
    260262 */
    261263
    262 DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(HGCMCLIENTID idClient,
     264DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(HGCMCLIENTID idClient, uint32_t fRequestor,
    263265                                             PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
    264266
     
    269271 * @param   pCallInfo           The request data.
    270272 * @param   fFlags              Flags, see VBGLR0_HGCMCALL_F_XXX.
     273 * @param   fRequestor          VMMDEV_REQUESTOR_XXX.
    271274 * @param   pfnAsyncCallback    Required pointer to function that is called when
    272275 *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
     
    277280 * @return VBox status code.
    278281 */
    279 DECLR0VBGL(int) VbglR0HGCMInternalCall(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
     282DECLR0VBGL(int) VbglR0HGCMInternalCall(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags, uint32_t fRequestor,
    280283                                       PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
    281284
     
    286289 * @param   pCallInfo           The request data.
    287290 * @param   fFlags              Flags, see VBGLR0_HGCMCALL_F_XXX.
     291 * @param   fRequestor          VMMDEV_REQUESTOR_XXX.
    288292 * @param   pfnAsyncCallback    Required pointer to function that is called when
    289293 *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
     
    294298 * @return  VBox status code.
    295299 */
    296 DECLR0VBGL(int) VbglR0HGCMInternalCall32(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
     300DECLR0VBGL(int) VbglR0HGCMInternalCall32(struct VBGLIOCHGCMCALL *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags, uint32_t fRequestor,
    297301                                         PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
    298302
  • trunk/include/VBox/VMMDev.h

    r69107 r70873  
    235235     *       real VMMDev request, only in the I/O control interface. */
    236236    uint32_t reserved1;
    237     /** Reserved field no.2. MBZ. */
    238     uint32_t reserved2;
     237    /** IN: Requestor information (VMMDEV_REQUESTOR_XXX) when
     238     * VBOXGSTINFO2_F_REQUESTOR_INFO is set, otherwise ignored by the host. */
     239    uint32_t fRequestor;
    239240} VMMDevRequestHeader;
    240241AssertCompileSize(VMMDevRequestHeader, 24);
     242
     243/** @name VMMDEV_REQUESTOR_XXX - Requestor information.
     244 *
     245 * This is information provided to the host by the VBoxGuest device driver, so
     246 * the host can implemented fine grained access to functionality if it likes.
     247 * @bugref{9105}
     248 *
     249 * @{ */
     250/** Requestor user not given. */
     251#define VMMDEV_REQUESTOR_USR_NOT_GIVEN              UINT32_C(0x00000000)
     252/** The kernel driver (VBoxGuest) is the requestor. */
     253#define VMMDEV_REQUESTOR_USR_DRV                    UINT32_C(0x00000001)
     254/** Some other kernel driver is the requestor. */
     255#define VMMDEV_REQUESTOR_USR_DRV_OTHER              UINT32_C(0x00000002)
     256/** The root or a admin user is the requestor. */
     257#define VMMDEV_REQUESTOR_USR_ROOT                   UINT32_C(0x00000003)
     258/** Requestor is the windows system user (SID S-1-5-18). */
     259#define VMMDEV_REQUESTOR_USR_SYSTEM                 UINT32_C(0x00000004)
     260/** Reserved requestor user \#1, treat like VMMDEV_REQUESTOR_USR_USER. */
     261#define VMMDEV_REQUESTOR_USR_RESERVED1              UINT32_C(0x00000005)
     262/** Regular joe user is making the request. */
     263#define VMMDEV_REQUESTOR_USR_USER                   UINT32_C(0x00000006)
     264/** Requestor is a guest user (or in a guest user group). */
     265#define VMMDEV_REQUESTOR_USR_GUEST                  UINT32_C(0x00000007)
     266/** User classification mask. */
     267#define VMMDEV_REQUESTOR_USR_MASK                   UINT32_C(0x00000007)
     268
     269/** Kernel mode request.
     270 * @note This is zero, so test for VMMDEV_REQUESTOR_USERMODE instead.  */
     271#define VMMDEV_REQUESTOR_KERNEL                     UINT32_C(0x00000000)
     272/** User mode request. */
     273#define VMMDEV_REQUESTOR_USERMODE                   UINT32_C(0x00000008)
     274
     275/** Don't know the physical console association of the requestor. */
     276#define VMMDEV_REQUESTOR_CON_DONT_KNOW              UINT32_C(0x00000000)
     277/** The request originates with a process that is NOT associated with the
     278 * physical console. */
     279#define VMMDEV_REQUESTOR_CON_NO                     UINT32_C(0x00000010)
     280/** Requestor process DOES is associated with the physical console. */
     281#define VMMDEV_REQUESTOR_CON_YES                    UINT32_C(0x00000020)
     282/** Requestor process belongs to user on the physical console, but cannot
     283 * ascertain that it is associated with that login. */
     284#define VMMDEV_REQUESTOR_CON_USER                   UINT32_C(0x00000030)
     285/** Requestor process belongs to user on the physical console, but cannot
     286 * ascertain that it is associated with that login. */
     287#define VMMDEV_REQUESTOR_CON_MASK                   UINT32_C(0x00000040)
     288
     289/** Requestor is member of special VirtualBox user group (not on windows). */
     290#define VMMDEV_REQUESTOR_GRP_VBOX                   UINT32_C(0x00000080)
     291/** Requestor is member of wheel / administrators group (SID S-1-5-32-544). */
     292#define VMMDEV_REQUESTOR_GRP_WHEEL                  UINT32_C(0x00000100)
     293
     294/** Requestor trust level: Unspecified */
     295#define VMMDEV_REQUESTOR_TRUST_NOT_GIVEN            UINT32_C(0x00000000)
     296/** Requestor trust level: Untrusted (SID S-1-16-0) */
     297#define VMMDEV_REQUESTOR_TRUST_UNTRUSTED            UINT32_C(0x00001000)
     298/** Requestor trust level: Untrusted (SID S-1-16-4096) */
     299#define VMMDEV_REQUESTOR_TRUST_LOW                  UINT32_C(0x00002000)
     300/** Requestor trust level: Medium (SID S-1-16-8192) */
     301#define VMMDEV_REQUESTOR_TRUST_MEDIUM               UINT32_C(0x00003000)
     302/** Requestor trust level: Medium plus (SID S-1-16-8448) */
     303#define VMMDEV_REQUESTOR_TRUST_MEDIUM_PLUS          UINT32_C(0x00004000)
     304/** Requestor trust level: High (SID S-1-16-12288) */
     305#define VMMDEV_REQUESTOR_TRUST_HIGH                 UINT32_C(0x00005000)
     306/** Requestor trust level: System (SID S-1-16-16384) */
     307#define VMMDEV_REQUESTOR_TRUST_SYSTEM               UINT32_C(0x00006000)
     308/** Requestor trust level: Protected or higher (SID S-1-16-20480, S-1-16-28672)
     309 * @note To avoid wasting an unnecessary bit, we combine the two top most
     310 *       mandatory security labels on Windows (protected and secure). */
     311#define VMMDEV_REQUESTOR_TRUST_PROTECTED            UINT32_C(0x00007000)
     312/** Requestor trust level mask.
     313 * The higher the value, the more the guest trusts the process. */
     314#define VMMDEV_REQUESTOR_TRUST_MASK                 UINT32_C(0x00007000)
     315
     316/** Requestor is using the less trusted user device node (/dev/vboxuser).
     317 * @note Currently only Linux sets this.  */
     318#define VMMDEV_REQUESTOR_USER_DEVICE                UINT32_C(0x00008000)
     319
     320/** Legacy value for when VBOXGSTINFO2_F_REQUESTOR_INFO is clear.
     321 * @internal Host only. */
     322#define VMMDEV_REQUESTOR_LEGACY                     UINT32_MAX
     323/** Used on the host to check whether a requestor value is present or not. */
     324#define VMMDEV_REQUESTOR_IS_PRESENT(a_fRequestor)   ((a_fRequestor) != VMMDEV_REQUESTOR_LEGACY)
     325/** @} */
    241326
    242327/** Initialize a VMMDevRequestHeader structure.
     
    244329#define VMMDEV_REQ_HDR_INIT(a_pHdr, a_cb, a_enmType) \
    245330    do { \
    246         (a_pHdr)->size        = (a_cb); \
    247         (a_pHdr)->version     = VMMDEV_REQUEST_HEADER_VERSION; \
    248         (a_pHdr)->requestType = (a_enmType); \
    249         (a_pHdr)->rc          = VERR_INTERNAL_ERROR; \
    250         (a_pHdr)->reserved1   = 0; \
    251         (a_pHdr)->reserved2   = 0; \
     331        (a_pHdr)->size         = (a_cb); \
     332        (a_pHdr)->version      = VMMDEV_REQUEST_HEADER_VERSION; \
     333        (a_pHdr)->requestType  = (a_enmType); \
     334        (a_pHdr)->rc           = VERR_INTERNAL_ERROR; \
     335        (a_pHdr)->reserved1    = 0; \
     336        (a_pHdr)->fRequestor   = 0; \
    252337    } while (0)
    253338
     
    651736    /** SVN revision. */
    652737    uint32_t additionsRevision;
    653     /** Feature mask, currently unused. */
     738    /** Feature mask, VBOXGSTINFO2_F_XXX. */
    654739    uint32_t additionsFeatures;
    655740    /** The intentional meaning of this field was:
     
    665750} VBoxGuestInfo2;
    666751AssertCompileSize(VBoxGuestInfo2, 144);
     752
     753/** @name VBOXGSTINFO2_F_XXX - Features
     754 * @{ */
     755/** Request header carries requestor information. */
     756#define VBOXGSTINFO2_F_REQUESTOR_INFO       RT_BIT_32(0)
     757/** @} */
     758
    667759
    668760/**
     
    17011793    req->rc          = VERR_GENERAL_FAILURE;
    17021794    req->reserved1   = 0;
    1703     req->reserved2   = 0;
     1795    req->fRequestor  = 0;
    17041796    return VINF_SUCCESS;
    17051797}
  • trunk/include/iprt/nt/nt.h

    r70417 r70873  
    15331533typedef FILE_FS_ATTRIBUTE_INFORMATION *PFILE_FS_ATTRIBUTE_INFORMATION;
    15341534
     1535#endif
    15351536NTSYSAPI NTSTATUS NTAPI NtOpenProcess(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PCLIENT_ID);
     1537NTSYSAPI NTSTATUS NTAPI ZwOpenProcess(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PCLIENT_ID);
     1538NTSYSAPI NTSTATUS NTAPI NtOpenThread(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PCLIENT_ID);
     1539NTSYSAPI NTSTATUS NTAPI ZwOpenThread(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PCLIENT_ID);
     1540
     1541#ifdef IPRT_NT_USE_WINTERNL
    15361542NTSYSAPI NTSTATUS NTAPI NtOpenProcessToken(HANDLE, ACCESS_MASK, PHANDLE);
    1537 NTSYSAPI NTSTATUS NTAPI NtOpenThread(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PCLIENT_ID);
    15381543NTSYSAPI NTSTATUS NTAPI NtOpenThreadToken(HANDLE, ACCESS_MASK, BOOLEAN, PHANDLE);
    1539 
     1544#endif
     1545NTSYSAPI NTSTATUS NTAPI ZwOpenProcessToken(HANDLE, ACCESS_MASK, PHANDLE);
     1546NTSYSAPI NTSTATUS NTAPI ZwOpenThreadToken(HANDLE, ACCESS_MASK, BOOLEAN, PHANDLE);
     1547
     1548#ifdef IPRT_NT_USE_WINTERNL
    15401549typedef enum _FSINFOCLASS
    15411550{
     
    16851694NTSYSAPI NTSTATUS NTAPI NtQueryFullAttributesFile(POBJECT_ATTRIBUTES, PFILE_NETWORK_OPEN_INFORMATION);
    16861695
     1696
     1697/** @name SE_GROUP_XXX - Attributes returned with TokenGroup and others.
     1698 * @{  */
     1699#ifndef SE_GROUP_MANDATORY
     1700# define SE_GROUP_MANDATORY             UINT32_C(0x01)
     1701#endif
     1702#ifndef SE_GROUP_ENABLED_BY_DEFAULT
     1703# define SE_GROUP_ENABLED_BY_DEFAULT    UINT32_C(0x02)
     1704#endif
     1705#ifndef SE_GROUP_ENABLED
     1706# define SE_GROUP_ENABLED               UINT32_C(0x04)
     1707#endif
     1708#ifndef SE_GROUP_OWNER
     1709# define SE_GROUP_OWNER                 UINT32_C(0x08)
     1710#endif
     1711#ifndef SE_GROUP_USE_FOR_DENY_ONLY
     1712# define SE_GROUP_USE_FOR_DENY_ONLY     UINT32_C(0x10)
     1713#endif
     1714#ifndef SE_GROUP_INTEGRITY
     1715# define SE_GROUP_INTEGRITY             UINT32_C(0x20)
     1716#endif
     1717#ifndef SE_GROUP_INTEGRITY_ENABLED
     1718# define SE_GROUP_INTEGRITY_ENABLED     UINT32_C(0x40)
     1719#endif
     1720#ifndef SE_GROUP_RESOURCE
     1721# define SE_GROUP_RESOURCE              UINT32_C(0x20000000)
     1722#endif
     1723#ifndef SE_GROUP_LOGON_ID
     1724# define SE_GROUP_LOGON_ID              UINT32_C(0xc0000000)
     1725#endif
     1726/** @} */
     1727
     1728
    16871729#ifdef IPRT_NT_USE_WINTERNL
    16881730
     
    19101952
    19111953NTSYSAPI NTSTATUS NTAPI NtQueryInformationToken(HANDLE, TOKEN_INFORMATION_CLASS, PVOID, ULONG, PULONG);
     1954NTSYSAPI NTSTATUS NTAPI ZwQueryInformationToken(HANDLE, TOKEN_INFORMATION_CLASS, PVOID, ULONG, PULONG);
    19121955
    19131956NTSYSAPI NTSTATUS NTAPI NtReadFile(HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID, PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER, PULONG);
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