VirtualBox

Ignore:
Timestamp:
Aug 31, 2016 11:16:18 AM (8 years ago)
Author:
vboxsync
Message:

HostDrivers/Support: make setting capabilities compatible for newer kernels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp

    r63573 r63673  
    512512# ifdef RT_OS_LINUX
    513513static uint32_t         g_uCaps;
     514static uint32_t         g_uCapsVersion;
    514515# endif
    515516#endif
     
    18081809#  else
    18091810        cap_user_header_t hdr = (cap_user_header_t)alloca(sizeof(*hdr));
    1810         cap_user_data_t   cap = (cap_user_data_t)alloca(sizeof(*cap));
     1811        cap_user_data_t   cap = (cap_user_data_t)alloca(2 /*_LINUX_CAPABILITY_U32S_3*/ * sizeof(*cap));
    18111812        memset(hdr, 0, sizeof(*hdr));
    1812         hdr->version = _LINUX_CAPABILITY_VERSION;
    1813         memset(cap, 0, sizeof(*cap));
     1813        capget(&hdr, NULL);
     1814        if (   hdr->version != 0x19980330 /* _LINUX_CAPABILITY_VERSION_1, _LINUX_CAPABILITY_U32S_1 = 1 */
     1815            && hdr->version != 0x20071026 /* _LINUX_CAPABILITY_VERSION_2, _LINUX_CAPABILITY_U32S_2 = 2 */
     1816            && hdr->version != 0x20080522 /* _LINUX_CAPABILITY_VERSION_3, _LINUX_CAPABILITY_U32S_3 = 2 */)
     1817            hdr->version = _LINUX_CAPABILITY_VERSION;
     1818        g_uCapsVersion = hdr->version;
     1819        memset(cap, 0, 2 /* _LINUX_CAPABILITY_U32S_3 */ * sizeof(*cap));
    18141820        cap->effective = g_uCaps;
    18151821        cap->permitted = g_uCaps;
     
    19821988#  else
    19831989        cap_user_header_t hdr = (cap_user_header_t)alloca(sizeof(*hdr));
    1984         cap_user_data_t   cap = (cap_user_data_t)alloca(sizeof(*cap));
     1990        cap_user_data_t   cap = (cap_user_data_t)alloca(2 /* _LINUX_CAPABILITY_U32S_3 */ * sizeof(*cap));
    19851991        memset(hdr, 0, sizeof(*hdr));
    1986         hdr->version = _LINUX_CAPABILITY_VERSION;
    1987         memset(cap, 0, sizeof(*cap));
     1992        hdr->version = g_uCapsVersion;
     1993        memset(cap, 0, 2 /* _LINUX_CAPABILITY_U32S_3 */ * sizeof(*cap));
    19881994        cap->effective = g_uCaps;
    19891995        cap->permitted = g_uCaps;
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