VirtualBox

Changeset 70874 in vbox for trunk/src/VBox/Additions


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

VBoxGuest: Linux build fix. bugref:9105

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c

    r70873 r70874  
    5252#include <linux/miscdevice.h>
    5353#include <linux/poll.h>
     54#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
     55# include <linux/tty.h>
     56#endif
    5457#include <VBox/version.h>
    5558#include "revision-generated.h"
     
    5760#include <iprt/assert.h>
    5861#include <iprt/asm.h>
     62#include <iprt/ctype.h>
    5963#include <iprt/err.h>
    6064#include <iprt/initterm.h>
     
    746750
    747751/**
     752 * Checks if the given group number is zero or not.
     753 *
     754 * @returns true / false.
     755 * @param   gid                 The group to check for.
     756 */
     757DECLINLINE(bool) vgdrvLinuxIsGroupZero(kgid_t gid)
     758{
     759#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
     760    return from_kgid(current_user_ns(), gid);
     761#else
     762    return gid == 0;
     763#endif
     764}
     765
     766
     767/**
    748768 * Searches the effective group and supplementary groups for @a gid.
    749769 *
     
    770790    uint32_t           fRet = VMMDEV_REQUESTOR_CON_DONT_KNOW;
    771791
    772 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     792#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) /* First with tty_kref_put(). */
    773793    /*
    774794     * Check for tty0..63, ASSUMING that these are only used for the physical console.
     
    791811                || (   RT_C_IS_DIGIT(pszName[4])
    792812                    && pszName[5] == '\0'
    793                     && (pszName[3] - '0') * 10 + (pszName[4] - '0') <= 63))
     813                    && (pszName[3] - '0') * 10 + (pszName[4] - '0') <= 63)) )
    794814               fRet = VMMDEV_REQUESTOR_CON_YES;
    795815        tty_kref_put(pTty);
     
    825845    if (MINOR(pInode->i_rdev) == g_MiscDeviceUser.minor)
    826846    {
    827         fRequestor |= VMMDEV_REQUESTOR_UNTRUSTED_DEVICE;
    828         if (pInode->i_gid && vgdrvLinuxIsInGroupEff(pInode->i_gid))
     847        fRequestor |= VMMDEV_REQUESTOR_USER_DEVICE;
     848        if (vgdrvLinuxIsGroupZero(pInode->i_gid) && vgdrvLinuxIsInGroupEff(pInode->i_gid))
    829849            fRequestor |= VMMDEV_REQUESTOR_GRP_VBOX;
    830850    }
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