- Timestamp:
- Oct 4, 2021 10:01:46 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 147254
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r90943 r91551 729 729 PSUPDRVUSAGE volatile pUsage; 730 730 731 /** The user id of the session. (Set by the OS part.) */ 731 /** The user id of the session - set by the OS part or NIL_RTUID. 732 * This should be unique accross namespace/zones/whatever. */ 732 733 RTUID Uid; 733 /** The group id of the session. (Set by the OS part.) */ 734 /** The group id of the session - set by the OS part or NIL_RTGID. 735 * This should be unique accross namespace/zones/whatever. */ 734 736 RTGID Gid; 735 737 /** Per session tracer specfic data. */ -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r90944 r91551 297 297 298 298 299 DECLINLINE(RTUID) vboxdrvLinuxUid(void) 299 /** Get the kernel UID for the current process. */ 300 DECLINLINE(RTUID) vboxdrvLinuxKernUid(void) 300 301 { 301 302 #if RTLNX_VER_MIN(2,6,29) 302 303 # if RTLNX_VER_MIN(3,5,0) 303 return from_kuid(current_user_ns(),current->cred->uid);304 return __kuid_val(current->cred->uid); 304 305 # else 305 306 return current->cred->uid; … … 310 311 } 311 312 312 DECLINLINE(RTGID) vboxdrvLinuxGid(void) 313 314 /** Get the kernel GID for the current process. */ 315 DECLINLINE(RTGID) vboxdrvLinuxKernGid(void) 313 316 { 314 317 #if RTLNX_VER_MIN(2,6,29) 315 318 # if RTLNX_VER_MIN(3,5,0) 316 return from_kgid(current_user_ns(),current->cred->gid);319 return __kgid_val(current->cred->gid); 317 320 # else 318 321 return current->cred->gid; … … 323 326 } 324 327 325 DECLINLINE(RTUID) vboxdrvLinuxEuid(void) 326 { 327 #if RTLNX_VER_MIN(2,6,29) 328 # if RTLNX_VER_MIN(3,5,0) 328 329 #ifdef VBOX_WITH_HARDENING 330 /** Get the effective UID within the current user namespace. */ 331 DECLINLINE(RTUID) vboxdrvLinuxEuidInNs(void) 332 { 333 # if RTLNX_VER_MIN(2,6,29) 334 # if RTLNX_VER_MIN(3,5,0) 329 335 return from_kuid(current_user_ns(), current->cred->euid); 336 # else 337 return current->cred->euid; 338 # endif 330 339 # else 331 return current->cred->euid;332 # endif333 #else334 340 return current->euid; 335 #endif 336 } 341 # endif 342 } 343 #endif 344 337 345 338 346 /** … … 509 517 */ 510 518 if ( fUnrestricted 511 && vboxdrvLinuxEuid () != 0 /* root */ )519 && vboxdrvLinuxEuidInNs() != 0 /* root */ ) 512 520 { 513 521 Log(("VBoxDrvLinuxCreate: euid=%d, expected 0 (root)\n", vboxdrvLinuxEuid())); … … 522 530 if (!rc) 523 531 { 524 pSession->Uid = vboxdrvLinux Uid();525 pSession->Gid = vboxdrvLinux Gid();532 pSession->Uid = vboxdrvLinuxKernUid(); 533 pSession->Gid = vboxdrvLinuxKernGid(); 526 534 } 527 535
Note:
See TracChangeset
for help on using the changeset viewer.