VirtualBox

Changeset 100772 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 1, 2023 5:34:48 PM (18 months ago)
Author:
vboxsync
Message:

include/VBox/usbfilter.h,HostDrivers/VBoxUSB/USBFilter: IUSBDeviceFilter:
USB device interval filters don't work. bugref:10452

Main/Host,Main/USBDeviceFilter: Adding or removing global USB device
filters causes memory corruption wihch can lead to a deadlock or a SEGV
as the list of global USB device filters (llChildren) changes while
the list is being walked.

Frontends/VBoxManage: 'VBoxManage list usbfilters' doesn't display the
'Port' value of the device filter.

Frontends/VBoxManage: 'VBoxManage add usbfilter' and 'VBoxManage modify
usbfilter' both ignore the --product="Value" option.

Main/VirtualBox.xidl: Improve the IUSBDeviceFilter wording to make
things clearer in the 'VirtualBox Programming Guide and Reference Guide'
aka SDKRef.pdf.

HostDrivers/VBoxUSB/testcase/tstUSBFilter: Include a variety of USB
device filter entries which include the 'int:' prefix to fully exercise
the interval filter parsing code.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r100737 r100772  
    74317431    <attribute name="USBProxyAvailable" type="boolean" readonly="yes">
    74327432      <desc>
    7433         Returns whether there is an USB proxy available.
     7433        Returns whether there is a USB proxy available.
    74347434      </desc>
    74357435    </attribute>
     
    1095510955      <rest request="post" path="/vms/{vmid}/configuration/"/>
    1095610956      <desc>
    10957         Detaches an USB device with the given UUID from the USB controller
     10957        Detaches a USB device with the given UUID from the USB controller
    1095810958        of the virtual machine.
    1095910959
     
    2308323083    >
    2308423084    <desc>
    23085       The IUSBDeviceFilter interface represents an USB device filter used
    23086       to perform actions on a group of USB devices.
    23087 
    23088       This type of filters is used by running virtual machines to
     23085      The IUSBDeviceFilter interface represents a USB device filter used
     23086      to perform actions on one or more USB devices.
     23087
     23088      USB device filters are used by running virtual machines to
    2308923089      automatically capture selected USB devices once they are physically
    2309023090      attached to the host computer.
    2309123091
    23092       A USB device is matched to the given device filter if and only if all
    23093       attributes of the device match the corresponding attributes of the
    23094       filter (that is, attributes are joined together using the logical AND
    23095       operation). On the other hand, all together, filters in the list of
    23096       filters carry the semantics of the logical OR operation. So if it is
    23097       desirable to create a match like "this vendor id OR this product id",
    23098       one needs to create two filters and specify "any match" (see below)
    23099       for unused attributes.
    23100 
    23101       All filter attributes used for matching are strings. Each string
    23102       is an expression representing a set of values of the corresponding
    23103       device attribute, that will match the given filter. Currently, the
    23104       following filtering expressions are supported:
     23092      A USB device is matched to a specific device filter if and only if all
     23093      attributes of the device filter match the corresponding attributes of the
     23094      device (that is, attributes are joined together using a logical AND
     23095      operation). On the other hand filter attributes in separate USB
     23096      device filters are applied as a logical OR operation. So if one
     23097      would like to create a match such as "this vendor id OR this product id",
     23098      then one would need to create two filters and specify "any match" (see below)
     23099      for the other unused attributes.
     23100
     23101      All filter attributes used for matching are strings.  The following
     23102      filtering expressions are currently supported:
    2310523103
    2310623104      <ul>
    2310723105        <li><i>Interval filters</i>. Used to specify valid intervals for
    23108           integer device attributes (Vendor ID, Product ID and Revision).
     23106          integer device attributes (Vendor ID, Product ID, Revision and Port).
    2310923107          The format of the string is:
    2311023108
     
    2311223110
    2311323111          where <tt>m</tt> and <tt>n</tt> are integer numbers, either in octal
    23114           (starting from <tt>0</tt>), hexadecimal (starting from <tt>0x</tt>)
    23115           or decimal (otherwise) form, so that <tt>m &lt; n</tt>. If <tt>m</tt>
     23112          (starting with <tt>0</tt>), hexadecimal (starting with <tt>0x</tt>)
     23113          or decimal (otherwise), so that <tt>m &lt; n</tt>. If <tt>m</tt>
    2311623114          is omitted before a dash (<tt>-</tt>), the minimum possible integer
    2311723115          is assumed; if <tt>n</tt> is omitted after a dash, the maximum
     
    2312623124        <li><i>Exact match</i>. Used to specify a single value for the given
    2312723125          device attribute. Any string that doesn't start with <tt>int:</tt>
    23128           represents the exact match. String device attributes are compared to
    23129           this string including case of symbols. Integer attributes are first
     23126          represents an exact match. String device attributes are compared to
     23127          this string in a case-sensitive manner. Integer attributes are first
    2313023128          converted to a string (see individual filter attributes) and then
    23131           compared ignoring case.
     23129          compared in a case-insensitive manner.
    2313223130
    2313323131        </li>
     
    2314023138
    2314123139      <note>
    23142         On the Windows host platform, interval filters are not currently
    23143         available. Also all string filter attributes
     23140        On Windows hosts, interval filters are not currently available.
     23141        Also all string filter attributes
    2314423142        (<link to="#manufacturer"/>, <link to="#product"/>,
    2314523143        <link to="#serialNumber"/>) are ignored, so they behave as
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r100108 r100772  
    217217
    218218#ifdef VBOX_WITH_USB
    219     USBDeviceFilterList     llChildren;                 // all USB device filters
     219    USBDeviceFilterList     llChildren;                 // all global USB device filters
    220220    USBDeviceFilterList     llUSBDeviceFilters;         // USB device filters in use by the USB proxy service
    221221
     
    535535
    536536#ifdef VBOX_WITH_USB
    537     /* uninit all USB device filters still referenced by clients
    538      * Note! HostUSBDeviceFilter::uninit() will modify llChildren.
    539      * This list should be already empty, but better be safe than sorry. */
    540     while (!m->llChildren.empty())
    541     {
    542         ComObjPtr<HostUSBDeviceFilter> &pChild = m->llChildren.front();
    543         pChild->uninit();
    544         m->llChildren.pop_front();
     537    /* Clean up the list of global USB device filters. */
     538    if (!m->llChildren.empty())
     539    {
     540        /*
     541         * i_removeChild() modifies llChildren so we make a copy to traverse here. The
     542         * removal of a global USB device filter from the llChildren list at this point
     543         * in Host:uninit() will trigger HostUSBDeviceFilter::FinalRelease() ->
     544         * HostUSBDeviceFilter::uninit() which will complete the remainder of the clean-up
     545         * for each global USB device filter and thus we don't need to call
     546         * HostUSBDeviceFilter::uninit() directly here ourselves.
     547         */
     548        USBDeviceFilterList llChildrenCopy(m->llChildren);
     549        for (USBDeviceFilterList::iterator it = llChildrenCopy.begin();
     550            it != llChildrenCopy.end();
     551            ++it)
     552            i_removeChild(*it);
    545553    }
    546554
  • trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp

    r98292 r100772  
    976976    bd.free();
    977977
    978     mParent->i_removeChild(this);
    979 
    980978    unconst(mParent) = NULL;
    981979}
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