Re: BadUSB - On Accessories that Turn Evil, by Karsten Nohl + Jakob Lell

2014-10-08 Thread Hans Petter Selasky

Hi Julian,

On 10/09/14 01:46, Julian H. Stacey wrote:

Hi Hans etc
"Julian H. Stacey" wrote:

Hans Petter Selasky wrote:

Hi,

Can you test the following kernel patch and give some feedback:

https://svnweb.freebsd.org/changeset/base/272733


I'm now on latest current with src & sys/ GENERIC
/usr/src/.ctm_status# src-cur 11645

This time I downloaded your files properly
(last time I was severely distracted & made a silly mistake)


After the patch you will get something like:
hw.usb.disable_enumeration: 0
dev.uhub.0.disable_enumeration: 0
dev.uhub.1.disable_enumeration: 0
...


sysctl -a | grep  enumeration
   hw.usb.disable_enumeration: 0
   dev.uhub.0.disable_enumeration: 0
   dev.uhub.1.disable_enumeration: 0
   dev.uhub.2.disable_enumeration: 0
   dev.uhub.3.disable_enumeration: 0
   dev.uhub.4.disable_enumeration: 0

sysctl -d hw.usb.disable_enumeration
   hw.usb.disable_enumeration: Set to disable all USB device enumeration.

sysctl -d dev.uhub.4.disable_enumeration
   dev.uhub.4.disable_enumeration: Set to disable enumeration on this USB HUB.

usbconfig
ugen0.1:  at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (0mA)
ugen1.1:  at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (0mA)
ugen0.2:  at usbus0, cfg=0 md=HOST spd=HIGH 
(480Mbps) pwr=SAVE (0mA)
ugen1.2:  at usbus1, cfg=0 md=HOST spd=HIGH 
(480Mbps) pwr=SAVE (0mA)
ugen0.3: <1.3M WebCam XPA2535XY> at usbus0, cfg=255 md=HOST spd=HIGH (480Mbps) 
pwr=OFF (500mA)
ugen1.3:  at usbus1, cfg=0 
md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen1.4:  at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (100mA)





Great ! Seems to work.

(Though I need to read up on how major & minor of ugen relate to
the digit in eg 4.disable_enumeration)



which is also settable through /boot/loader.conf (tunable)


Good,
I hope/presume loader.conf gets run before any USB, cos I recall
lecturer Karsten Nohl pointing out one could get BadUSB taking up
residence in USB controller chips inside a PC, ie for a built in
mouse or web cam, so one would need to turn off enumeration earlier
than when first external USB approaches to connect.


Yes, if set by the loader.conf, you will only see the RootHUB after boot.

To get devices back after enabling enumeration again, you will need to 
reset the HUBs:


usbconfig -d X.1 reset

For example.

BTW: I've added some exceptions, that existing devices can be detached, 
suspend/resumed and reset while the enumeration is disabled.


https://svnweb.freebsd.org/changeset/base/272807



I've reported back on BBC news form:
Ref. your
6 October 2014 Last updated at 15:29 GMT
http://www.bbc.com/news/technology-29475566

The www.FreeBSD.org project (a Unix OS similar to Linux)
took just 2 days to develop & test a free solution.
http://lists.freebsd.org/pipermail/freebsd-usb/2014-October/013304.html



Can you also test that patch?

Thank you!

--HPS

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: BadUSB - On Accessories that Turn Evil, by Karsten Nohl + Jakob Lell

2014-10-08 Thread Julian H. Stacey
Hi Hans etc
"Julian H. Stacey" wrote:
> Hans Petter Selasky wrote:
> > Hi,
> > 
> > Can you test the following kernel patch and give some feedback:
> > 
> > https://svnweb.freebsd.org/changeset/base/272733

I'm now on latest current with src & sys/ GENERIC 
/usr/src/.ctm_status# src-cur 11645

This time I downloaded your files properly
(last time I was severely distracted & made a silly mistake)

> > After the patch you will get something like:
> > hw.usb.disable_enumeration: 0
> > dev.uhub.0.disable_enumeration: 0
> > dev.uhub.1.disable_enumeration: 0
> > ...

sysctl -a | grep  enumeration
  hw.usb.disable_enumeration: 0
  dev.uhub.0.disable_enumeration: 0
  dev.uhub.1.disable_enumeration: 0
  dev.uhub.2.disable_enumeration: 0
  dev.uhub.3.disable_enumeration: 0
  dev.uhub.4.disable_enumeration: 0

sysctl -d hw.usb.disable_enumeration
  hw.usb.disable_enumeration: Set to disable all USB device enumeration.

sysctl -d dev.uhub.4.disable_enumeration
  dev.uhub.4.disable_enumeration: Set to disable enumeration on this USB HUB.

usbconfig
ugen0.1:  at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (0mA)
ugen1.1:  at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (0mA)
ugen0.2:  at usbus0, cfg=0 md=HOST spd=HIGH 
(480Mbps) pwr=SAVE (0mA)
ugen1.2:  at usbus1, cfg=0 md=HOST spd=HIGH 
(480Mbps) pwr=SAVE (0mA)
ugen0.3: <1.3M WebCam XPA2535XY> at usbus0, cfg=255 md=HOST spd=HIGH (480Mbps) 
pwr=OFF (500mA)
ugen1.3:  at usbus1, cfg=0 
md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen1.4:  at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (100mA)

Inserted a WLAN stick
usbconfig
ugen1.5: <802.11 n WLAN Ralink> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=ON (450mA)
ifconfig -a shows run0 & wlan0

Removed WLAN stick
sysctl dev.uhub.4.disable_enumeration=1

Added WLAN stick
ifconfig -a No run0 & wlan0

Added WLAN stick on different direct PC socket:
ifconfig -a Shows run0 & wlan0

usbconfig
ugen0.1:  at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (0mA)
ugen1.1:  at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (0mA)
ugen0.2:  at usbus0, cfg=0 md=HOST spd=HIGH 
(480Mbps) pwr=SAVE (0mA)
ugen1.2:  at usbus1, cfg=0 md=HOST spd=HIGH 
(480Mbps) pwr=SAVE (0mA)
ugen0.3: <1.3M WebCam XPA2535XY> at usbus0, cfg=255 md=HOST spd=HIGH (480Mbps) 
pwr=OFF (500mA)
ugen1.3:  at usbus1, cfg=0 
md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen1.4:  at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=SAVE (100mA)
ugen1.5: <802.11 n WLAN Ralink> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=ON (450mA)

Great ! Seems to work.

(Though I need to read up on how major & minor of ugen relate to
the digit in eg 4.disable_enumeration)


> > which is also settable through /boot/loader.conf (tunable)

Good, 
I hope/presume loader.conf gets run before any USB, cos I recall
lecturer Karsten Nohl pointing out one could get BadUSB taking up
residence in USB controller chips inside a PC, ie for a built in
mouse or web cam, so one would need to turn off enumeration earlier
than when first external USB approaches to connect.

I've reported back on BBC news form:
Ref. your 
6 October 2014 Last updated at 15:29 GMT 
http://www.bbc.com/news/technology-29475566

The www.FreeBSD.org project (a Unix OS similar to Linux)
took just 2 days to develop & test a free solution.
http://lists.freebsd.org/pipermail/freebsd-usb/2014-October/013304.html

Well done, Thanks Hans!

Cheers,
Julian
-- 
Julian Stacey, BSD Linux Unix C Sys Eng Consultant Munich http://berklix.com
 Indent previous with "> ".  Interleave reply paragraphs like a play script.
 Send plain text, not quoted-printable, HTML, base64, or multipart/alternative.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: BadUSB - On Accessories that Turn Evil, by Karsten Nohl + Jakob Lell

2014-10-08 Thread Julian H. Stacey
Hans Petter Selasky wrote:
> Hi,
> 
> Can you test the following kernel patch and give some feedback:
> 
> https://svnweb.freebsd.org/changeset/base/272733
> 
> After the patch you will get something like:
> 
> hw.usb.disable_enumeration: 0
> dev.uhub.0.disable_enumeration: 0
> dev.uhub.1.disable_enumeration: 0
> ...
> 
> which is also settable through /boot/loader.conf (tunable)

Thanks, Quick work !
I downloaded, but before use,
I ran a make world as my current was maybe a week or 2 old,
I made a new generic kernel with CTM src-cur.11644.gz ie (latest
CVS as supplied by CTM)
But src/ make all failed so I ran make world, which also failed:
---
/usr/obj/usr/src/tmp/usr/include/dev/usb/usb.h:154:16: note: forward 
declaration
  of 'struct usb_device_request'
typedef struct usb_device_request usb_device_request_t;
   ^
19 errors generated.
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib/libusbhid
---

In parallel to make world I applied your patches to make & that failed:

/sys/amd64/compile/GENERIC 
../../../dev/usb/usbdi.h:301:5: warning: 'USB_HAVE_COMPAT_LINUX' is not 
defined, evaluates to 0 [-Wundef]
#if USB_HAVE_COMPAT_LINUX
^
2 warnings generated.
mkdep: compile failed
*** Error code 1

Stop.
make: stopped in /usr/src/sys/amd64/compile/GENERIC

But that may be because my system is pehaps a couple of weeks old or so.

The latest generic src/ kernel booted OK 
FreeBSD lapr.js.berklix.net 11.0-CURRENT FreeBSD 11.0-CURRENT #1: Wed 
Oct  8 17:26:13 CEST 2014 
j...@lapr.js.berklix.net:/usr/src/sys/amd64/compile/GENERIC  amd64
(though I noticed a named: lock order reversal that I will ignore)

When I can get src/ to build (I'm using make -k all now :-),
I'll go back to compiling GENERIC kernel with your changeset/base/272733

Cheers,
Julian
-- 
Julian Stacey, BSD Linux Unix C Sys Eng Consultant Munich http://berklix.com
 Indent previous with "> ".  Interleave reply paragraphs like a play script.
 Send plain text, not quoted-printable, HTML, base64, or multipart/alternative.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 194226] USB does not work early in the boot process when 60/64 emulation support is enabled

2014-10-08 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194226

--- Comment #5 from ne...@otherware.org ---
Yes. Standby.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 194226] USB does not work early in the boot process when 60/64 emulation support is enabled

2014-10-08 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194226

--- Comment #4 from Hans Petter Selasky  ---
Can you show dmesg?

--HPS

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 194226] USB does not work early in the boot process when 60/64 emulation support is enabled

2014-10-08 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194226

--- Comment #3 from ne...@otherware.org ---
Using vanilla 10.1-BETA3 kernel. No changes in kernel on how "ukbd" is loaded.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: XHCI device probe inconsistency

2014-10-08 Thread Mike Tancsa

On 10/8/2014 5:27 AM, Hans Petter Selasky wrote:

Hi,

If you plug the device after boot, what happens then?

What speed does the BIOS enumerate the device at?

Have you checked for USB related BIOS settings?


Hi,
	Hmmm, I could not recreate the issue at first!!  I tried both a soft 
and cold boot, and with and without a CF in it and it would always come 
up as USB3


And then I remember setting the BIOS option

Make USB Non Bootable (Enable/Disable)

so it would not try and boot from the flash.

Once I set that to enable, so it could not boot from a USB device, the 
CF Reader/Writer always probes as USB3 speed!  When its disabled, at 
boot time it probes as USB2 speeds until I disconnect / reconnect.


Thanks!

---Mike




--
---
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, m...@sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 194226] USB does not work early in the boot process when 60/64 emulation support is enabled

2014-10-08 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194226

Hans Petter Selasky  changed:

   What|Removed |Added

   Priority|--- |Normal
 Status|Needs Triage|In Discussion

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 194226] USB does not work early in the boot process when 60/64 emulation support is enabled

2014-10-08 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194226

Hans Petter Selasky  changed:

   What|Removed |Added

 CC||hsela...@freebsd.org

--- Comment #2 from Hans Petter Selasky  ---
Hi,

Is the "ukbd" driver in the kernel or loaded as a module?

If the keyboard is enumerated before the mount root prompt and password prompt,
it should work.

There are some loader options to make the kernel wait a bit more for USB
devices to show up.

BTW: Is this also a problem with 10-stable. Depending on your USB controller,
the following patch might help:

https://svnweb.freebsd.org/changeset/base/272589

--HPS

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: XHCI device probe inconsistency

2014-10-08 Thread Hans Petter Selasky

On 10/07/14 21:04, Mike Tancsa wrote:

ugen0.4:  at usbus0, cfg=0 md=HOST
spd=SUPER (5.0Gbps) pwr=ON (200mA)


Hi,

If you plug the device after boot, what happens then?

What speed does the BIOS enumerate the device at?

Have you checked for USB related BIOS settings?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Panic in usb_unref_device

2014-10-08 Thread Hans Petter Selasky

On 10/07/14 23:19, Daniel O'Connor wrote:


On 3 Oct 2014, at 21:18, Hans Petter Selasky  wrote:

On 10/03/14 13:19, Daniel O'Connor wrote:

Hi,
I have a custom USB device based on the Cypress FX2 and we are finding that with 
some older kernels it hangs - this was fixed in 
https://svnweb.freebsd.org/base?view=revision&revision=267240 but now it panics 
with…


There's a minor bug there. Can you test the attached patch?


Sorry for the late reply (there was a holiday on Monday here) - the patch seems 
to have fixed the crash, thanks!


You're welcome!

--HPS

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: xhci problem on UEFI boot MacBookPro 11,3

2014-10-08 Thread Hans Petter Selasky
FYI

This issue was fixed by:

https://svnweb.freebsd.org/changeset/base/272589

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: BadUSB - On Accessories that Turn Evil, by Karsten Nohl + Jakob Lell

2014-10-08 Thread Hans Petter Selasky

Hi,

Can you test the following kernel patch and give some feedback:

https://svnweb.freebsd.org/changeset/base/272733

After the patch you will get something like:

hw.usb.disable_enumeration: 0
dev.uhub.0.disable_enumeration: 0
dev.uhub.1.disable_enumeration: 0
...

which is also settable through /boot/loader.conf (tunable)

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"