Changeset 44181 in vbox for trunk/src/VBox
- Timestamp:
- Dec 19, 2012 7:10:10 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 82891
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r44173 r44181 72 72 * Defined Constants And Macros * 73 73 *******************************************************************************/ 74 /** The module name. */ 75 #define DEVICE_NAME "vboxdrv" 74 /** The system device name. */ 75 #define DEVICE_NAME_SYS "vboxdrv" 76 /** The user device name. */ 77 #define DEVICE_NAME_USR "vboxdrvu" 76 78 /** The module description as seen in 'modinfo'. */ 77 79 #define DEVICE_DESC "VirtualBox HostDrv" … … 344 346 */ 345 347 #ifdef VBOX_WITH_HARDENING 346 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME , S_IFCHR, instance, DDI_PSEUDO,348 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME_SYS, S_IFCHR, 0 /*minor*/, DDI_PSEUDO, 347 349 0, NULL, NULL, 0600); 348 350 #else 349 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME , S_IFCHR, instance, DDI_PSEUDO,351 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME_SYS, S_IFCHR, 0 /*minor*/, DDI_PSEUDO, 350 352 0, "none", "none", 0666); 351 353 #endif 352 354 if (rc == DDI_SUCCESS) 353 355 { 356 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME_USR, S_IFCHR, 1 /*minor*/, DDI_PSEUDO, 357 0, "none", "none", 0666); 358 if (rc == DDI_SUCCESS) 359 { 354 360 #ifdef USE_SESSION_HASH 355 pState->pDip = pDip;361 pState->pDip = pDip; 356 362 #endif 357 ddi_report_dev(pDip); 358 return DDI_SUCCESS; 363 ddi_report_dev(pDip); 364 return DDI_SUCCESS; 365 } 366 ddi_remove_minor_node(pDip, NULL); 359 367 } 360 368 … … 434 442 435 443 /** 436 * User context entry points444 * open() worker. 437 445 */ 438 446 static int VBoxDrvSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred) 439 447 { 448 const bool fUnrestricted = getminor(*devp) == 0; 449 PSUPDRVSESSION pSession; 440 450 int rc; 441 PSUPDRVSESSION pSession; 451 442 452 LogFlowFunc(("VBoxDrvSolarisOpen: pDev=%p:%#x\n", pDev, *pDev)); 453 454 /* 455 * Validate input 456 */ 457 if ( (getminor(*devp) != 0 && getminor(*devp) != 1) 458 || fType != OTYP_CHR) 459 return EINVAL; /* See mmopen for precedent. */ 443 460 444 461 #ifndef USE_SESSION_HASH … … 469 486 * Create a new session. 470 487 */ 471 rc = supdrvCreateSession(&g_DevExt, true /* fUser */, true /*fUnrestricted*/, &pSession);488 rc = supdrvCreateSession(&g_DevExt, true /* fUser */, fUnrestricted, &pSession); 472 489 if (RT_SUCCESS(rc)) 473 490 { … … 491 508 * in VBoxDrvSolarisIOCtlSlow() while calling supdrvIOCtl() 492 509 */ 493 rc = supdrvCreateSession(&g_DevExt, true /* fUser */, true /*fUnrestricted*/, &pSession);510 rc = supdrvCreateSession(&g_DevExt, true /* fUser */, fUnrestricted, &pSession); 494 511 if (RT_SUCCESS(rc)) 495 512 { … … 502 519 * Insert it into the hash table. 503 520 */ 521 # error "Only one entry per process!" 504 522 iHash = SESSION_HASH(pSession->Process); 505 523 RTSpinlockAcquire(g_Spinlock); … … 659 677 const unsigned iHash = SESSION_HASH(Process); 660 678 PSUPDRVSESSION pSession; 679 const bool fUnrestricted = getminor(Dev) == 0; 661 680 662 681 /* … … 665 684 RTSpinlockAcquire(g_Spinlock); 666 685 pSession = g_apSessionHashTab[iHash]; 667 if (pSession && pSession->Process != Process) 668 { 669 do pSession = pSession->pNextHash; 670 while (pSession && pSession->Process != Process); 671 } 686 while (pSession && pSession->Process != Process && pSession->fUnrestricted == fUnrestricted); 687 pSession = pSession->pNextHash; 672 688 RTSpinlockReleaseNoInts(g_Spinlock); 673 689 if (!pSession) 674 690 { 675 LogRel(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x \n",676 (int)Process, Cmd ));691 LogRel(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x Dev=%#x\n", 692 (int)Process, Cmd, (int)Dev)); 677 693 return EINVAL; 678 694 } … … 683 699 * the session and iCmd, and only returns a VBox status code. 684 700 */ 685 if ( Cmd == SUP_IOCTL_FAST_DO_RAW_RUN 686 || Cmd == SUP_IOCTL_FAST_DO_HM_RUN 687 || Cmd == SUP_IOCTL_FAST_DO_NOP) 701 if ( ( Cmd == SUP_IOCTL_FAST_DO_RAW_RUN 702 || Cmd == SUP_IOCTL_FAST_DO_HM_RUN 703 || Cmd == SUP_IOCTL_FAST_DO_NOP) 704 && pSession->fUnrestricted) 688 705 { 689 706 *pVal = supdrvIOCtlFast(Cmd, pArgs, &g_DevExt, pSession);
Note:
See TracChangeset
for help on using the changeset viewer.