[vbox-dev] [PATCH] VBoxUsbMon: Hook proper driver object

Michal Necasek michal.necasek at oracle.com
Thu Jul 13 12:26:27 GMT 2017


  The copyright holder of the patch needs to simply state that the patch 
is provided under the MIT license. Nothing complicated, we just need a 
written record. You can either submit the patch again with the 
additional statement, or post an e-mail clearly identifying the 
previously submitted patch.

  See https://www.virtualbox.org/wiki/Contributor_information for details.

    - Michal

On 7/13/2017 2:05 PM, Sameeh Jubran wrote:
> 
> 
> On Thu, Jul 13, 2017 at 2:59 PM, Michal Necasek 
> <michal.necasek at oracle.com <mailto:michal.necasek at oracle.com>> wrote:
> 
> 
>          Hi Sameeh/Yuri,
> 
>       Thanks for the patch. For us to actually accept it, the patch
>     needs to be either explicitly licensed under MIT or submitted by
>     someone with a signed OCA (Oracle Contributors Agreement).
> 
> No problem, how should we explicitly license it under MIT?
> 
> 
>       Do you happen to know if the patch also solves interoperability
>     problems with USBPcap?
> 
> Probably but we haven't tested that.
> 
> 
> 
>           Regards,
>             Michal
> 
> 
>     On 7/12/2017 10:39 AM, Sameeh Jubran wrote:
> 
>         From: Yuri Benditovich <yuri.benditovich at daynix.com
>         <mailto:yuri.benditovich at daynix.com>>
> 
>         VBoxUsbMon hooks PnP call in driver object of top level devices
>         in stack of every hub. There is assumption that such a way it
>         will receive PnP messages for PDOs of USB devices created by
>         these hubs. This assumption is not always correct: if there is
>         upper filter installed in stack of hub devices but not in stack
>         of USB devices, the VBoxUsbMon does not receive devices' PnP
>         messages and USB redirection does not work.
>         ---
>            src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp |  4 ++++
>            src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp | 10
>         ++++++++++
>            src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h   |  2 ++
>            3 files changed, 16 insertions(+)
> 
>         diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp
>         b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp
>         index bd1eeaa..63cf973 100644
>         --- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp
>         +++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp
>         @@ -725,6 +725,7 @@ static bool
>         vboxUsbFltDevCheckReplugLocked(PVBOXUSBFLT_DEVICE pDevice, PVBOXUSBF
>                            LOG(("Matching: Need replug"));
>                            /* the device needs to be filtered, but the
>         owner changes, replug needed */
>                            bNeedReplug = true;
>         +                EnsureDeviceIsFiltered(pDevice->Pdo);
>                        }
>                    }
>                    else
>         @@ -740,6 +741,7 @@ static bool
>         vboxUsbFltDevCheckReplugLocked(PVBOXUSBFLT_DEVICE pDevice, PVBOXUSBF
>                        {
>                            bNeedReplug = true;
>                            LOG(("Matching: Need replug"));
>         +                EnsureDeviceIsFiltered(pDevice->Pdo);
>                        }
>                    }
>                }
>         @@ -852,6 +854,7 @@ static DECLCALLBACK(BOOLEAN)
>         vboxUsbFltFilterCheckWalker(PFILE_OBJECT pFile, PDE
>                            if (fFilter)
>                            {
>                                LOG(("Matching: This device SHOULD be
>         filtered"));
>         +                    EnsureDeviceIsFiltered(Device.Pdo);
>                                /* this device needs to be filtered, but
>         it's not,
>                                 * leave the PDO in array to issue a
>         replug request for it
>                                 * later on */
>         @@ -1295,6 +1298,7 @@ NTSTATUS VBoxUsbFltPdoAdd(PDEVICE_OBJECT
>         pPdo, BOOLEAN *pbFiltered)
>                    ASSERT_WARN(pCtx, ("zero ctx"));
>                    ASSERT_WARN(uId, ("zero uId"));
>                    pDevice->enmState = VBOXUSBFLT_DEVSTATE_CAPTURING;
>         +        EnsureDeviceIsFiltered(pPdo);
>                }
>                else
>                {
>         diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
>         b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
>         index dba6c1d..307abe5 100644
>         --- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
>         +++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
>         @@ -1259,6 +1259,16 @@ static DECLCALLBACK(BOOLEAN)
>         vboxUsbMonHookDrvObjWalker(PFILE_OBJECT pFile, PDEV
>                return FALSE;
>            }
>            +
>         +/**
>         +* Ensure PnP hooks will be installed in the driver that
>         +  serves USB device PDO
>         +*/
>         +void EnsureDeviceIsFiltered(PDEVICE_OBJECT Pdo)
>         +{
>         +    vboxUsbMonHookDrvObjWalker(NULL, NULL, Pdo, NULL);
>         +}
>         +
>            /**
>             * Finds all USB drivers in the system and installs hooks if
>         haven't done already.
>             */
>         diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h
>         b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h
>         index b218bde..c64d789 100644
>         --- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h
>         +++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.h
>         @@ -58,4 +58,6 @@ typedef FNVBOXUSBMONDEVWALKER
>         *PFNVBOXUSBMONDEVWALKER;
>              VOID vboxUsbMonHubDevWalk(PFNVBOXUSBMONDEVWALKER pfnWalker,
>         PVOID pvWalker, ULONG fFlags);
>            +void EnsureDeviceIsFiltered(PDEVICE_OBJECT Pdo);
>         +
>            #endif /* #ifndef ___VBoxUsbMon_h___ */
> 
> 
>     _______________________________________________
>     vbox-dev mailing list
>     vbox-dev at virtualbox.org <mailto:vbox-dev at virtualbox.org>
>     https://www.virtualbox.org/mailman/listinfo/vbox-dev
>     <https://www.virtualbox.org/mailman/listinfo/vbox-dev>
> 
> 
> 
> 
> -- 
> Respectfully,
> */Sameeh Jubran/*
> /Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>/
> /Software Engineer @ Daynix <http://www.daynix.com>./




More information about the vbox-dev mailing list