Re: [PATCH RESEND (1-3)/4] Add usb interface authorization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Dienstag, den 09.06.2015, 13:20 -0400 schrieb Alan Stern:
> On Tue, 9 Jun 2015, Stefan Koch wrote:
> 
> > Am Dienstag, den 09.06.2015, 10:31 -0400 schrieb Alan Stern:
> > > On Tue, 9 Jun 2015, Stefan Koch wrote:
> > > 
> > > > Hi
> > > > 
> > > > I think whitespaces should be ok now. I have tested now three mail
> > > > clients...
> > > > 
> > > > This patch series enables the interface authorization. The description
> > > > is improved now. Is the series correct now?
> > > 
> > > This patch series is much, much more complicated than necessary.
> > > 
> > > > The first patch allows to handle the probing of drivers
> > > >  manually.
> > > 
> > > Why do you do that?  It's completely unrelated to the problem of
> > > authorizing USB interfaces.
> > To prevent drivers from binding.
> 
> But you don't care about all drivers in general; you only care about
> drivers binding to USB interfaces.  So you should change only the USB 
> binding routines, not the routines in drivers/base/bus.c.
> 
> > > > And the third patch introduces the usb interface authorization. This is
> > > > the main concern of this kernel modification.
> > > 
> > > This patch also is more complicated than it should be.  Why do you want
> > > to unregister and then re-register the interfaces?  All you need to do
> > > is unbind drivers and prevent other drivers from binding.
> > Do you see a much simplier method to prevent drivers from binding as
> > with patch 1?
> 
> Yes, and you already included it in your 3/4 patch -- the changes you 
> made to usb_probe_interface() and usb_claim_interface().
> 
> > Another approach could be to check in bus_probe_device() (bus.c) if the
> > bus is "usb" and then use to_usb_interface() or so on and check the intf
> > auth status bit.
> 
> Again, why bother?  It's silly to check for the usb bus in 
> bus_probe_device(), when usb_probe_interface() already _knows_ that the 
> bus is usb.
> 
> Alan Stern
> 
There is one problem with that simple approach without the manually
probe patch. As example the USB-Tethering with smartphones.

There is a driver (module) loading. It is loaded although
usb_probe_interface() denies the interface.

I think that's not so good that there are unused modules loaded.
So the approach with the manually probing possibility could solve that.

An other approach could be to make a device_add_opt_probe(DEVICE,
BOOLEAN), because that is used in usb_set_configuration(). Inside of
device_add() is the function bus_probe_device(). These could disabled
with unauthorized interfaces by the BOOLEAN parameter.

In usb_register_driver() it is not possible to detect an interface.

What do you think?

Thanks

Stefan Koch

dmesg with dump printing:

[  125.011443] usb 3-3: new high-speed USB device number 6 using
xhci_hcd
[  125.176930] usb 3-3: New USB device found, idVendor=04e8,
idProduct=6864
[  125.176934] usb 3-3: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[  125.176936] usb 3-3: Product: SAMSUNG_Android
[  125.176937] usb 3-3: Manufacturer: SAMSUNG
[  125.176939] usb 3-3: SerialNumber: 10850d17
[  125.231054] CPU: 5 PID: 1891 Comm: systemd-udevd Not tainted
4.1.0-rc7-21-desktop+ #8
[  125.231060]  0000000000000000 ffff880259253c78 ffffffff8169e8b7
0000000080000001
[  125.231065]  ffffffffa0a0a000 ffff880259253ca8 ffffffff814f3b65
ffffffff81c15020
[  125.231068]  ffff880264597e20 0000000000000000 ffffffffa0a0d000
ffff880259253cb8
[  125.231071] Call Trace:
[  125.231079]  [<ffffffff8169e8b7>] dump_stack+0x4c/0x6e
[  125.231084]  [<ffffffff814f3b65>] usb_register_driver+0x115/0x170
[  125.231091]  [<ffffffffa0a0d000>] ? 0xffffffffa0a0d000
[  125.231094]  [<ffffffffa0a0d01e>] cdc_driver_init+0x1e/0x1000
[cdc_ether]
[  125.231096]  [<ffffffff81000314>] do_one_initcall+0xd4/0x210
[  125.231099]  [<ffffffff8169a51f>] do_init_module+0x61/0x1cc
[  125.231102]  [<ffffffff810f0214>] load_module+0x1d64/0x2670
[  125.231104]  [<ffffffff810ebd30>] ? store_uevent+0x40/0x40
[  125.231107]  [<ffffffff810f0d16>] SyS_finit_module+0x86/0xb0
[  125.231112]  [<ffffffff816a53f2>] system_call_fastpath+0x16/0x75
[  125.231114] usbcore: registered new interface driver cdc_ether
[  125.240235] rndis_host 3-3:1.0: Interface 0x00 is not authorized for
usage
[  125.240265] CPU: 5 PID: 1891 Comm: systemd-udevd Not tainted
4.1.0-rc7-21-desktop+ #8
[  125.240270]  0000000000000000 ffff880259253c78 ffffffff8169e8b7
0000000080000001
[  125.240274]  ffffffffa0a03000 ffff880259253ca8 ffffffff814f3b65
ffffffff81c15020
[  125.240278]  ffff8802645973e0 0000000000000000 ffffffffa0a11000
ffff880259253cb8
[  125.240281] Call Trace:
[  125.240286]  [<ffffffff8169e8b7>] dump_stack+0x4c/0x6e
[  125.240290]  [<ffffffff814f3b65>] usb_register_driver+0x115/0x170
[  125.240297]  [<ffffffffa0a11000>] ? 0xffffffffa0a11000
[  125.240301]  [<ffffffffa0a1101e>] rndis_driver_init+0x1e/0x1000
[rndis_host]
[  125.240303]  [<ffffffff81000314>] do_one_initcall+0xd4/0x210
[  125.240305]  [<ffffffff8169a51f>] do_init_module+0x61/0x1cc
[  125.240307]  [<ffffffff810f0214>] load_module+0x1d64/0x2670
[  125.240309]  [<ffffffff810ebd30>] ? store_uevent+0x40/0x40
[  125.240314]  [<ffffffff810f0d16>] SyS_finit_module+0x86/0xb0
[  125.240317]  [<ffffffff816a53f2>] system_call_fastpath+0x16/0x75
[  125.240320] usbcore: registered new interface driver rndis_host


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux