Possible binary incompatible change of struct usb_device_info in 2018

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible binary incompatible change of struct usb_device_info in 2018

Enrik Berkhan
>Synopsis: Undocumented change of struct usb_device_info
>Category: documentation kernel
>Environment:
        System      : OpenBSD 6.8
        Details     : OpenBSD 6.8 (GENERIC.MP) #98: Sun Oct  4 18:13:26 MDT 2020
                         [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64
>Description:
        struct usb_device_info has been changed in sys/dev/usb/usb.h from version
        1.59 to 1.60 on 2018-07-10 most probably resizing it and relocating its
        last member udi_serial in memory.

    This change is not documented in usb(4).
>How-To-Repeat:
        n/a
>Fix:
        n/a


dmesg:
OpenBSD 6.8 (GENERIC.MP) #98: Sun Oct  4 18:13:26 MDT 2020
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 2130558976 (2031MB)
avail mem = 2051010560 (1955MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xf5ac0 (10 entries)
bios0: vendor SeaBIOS version "1.14.0-1" date 04/01/2014
bios0: QEMU Standard PC (i440FX + PIIX, 1996)
acpi0 at bios0: ACPI 1.0
acpi0: sleep states S5
acpi0: tables DSDT FACP APIC HPET
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel Core Processor (Haswell, no TSX, IBRS), 2195.05 MHz, 06-3c-01
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,SSE3,PCLMUL,VMX,SSSE3,FMA3,CX16,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,UMIP,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,ARAT,XSAVEOPT,MELTDOWN
cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache
cpu0: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
cpu0: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 1000MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel Core Processor (Haswell, no TSX, IBRS), 2194.81 MHz, 06-3c-01
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,SSE3,PCLMUL,VMX,SSSE3,FMA3,CX16,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,UMIP,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,ARAT,XSAVEOPT,MELTDOWN
cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache
cpu1: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
cpu1: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
cpu1: smt 0, core 0, package 1
ioapic0 at mainbus0: apid 0 pa 0xfec00000, version 11, 24 pins
acpihpet0 at acpi0: 100000000 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
"ACPI0006" at acpi0 not configured
acpipci0 at acpi0 PCI0
acpicmos0 at acpi0
"PNP0A06" at acpi0 not configured
"PNP0A06" at acpi0 not configured
"PNP0A06" at acpi0 not configured
"QEMU0002" at acpi0 not configured
"ACPI0010" at acpi0 not configured
acpicpu0 at acpi0: C1(@1 halt!)
acpicpu1 at acpi0: C1(@1 halt!)
cpu0: using VERW MDS workaround
pvbus0 at mainbus0: KVM, Hyper-V 6.1
pvclock0 at pvbus0
hyperv0 at pvbus0: not functional
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility
atapiscsi0 at pciide0 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <QEMU, QEMU DVD-ROM, 2.5+> removable
cd0(pciide0:0:0): using PIO mode 4, DMA mode 2
pciide0: channel 1 disabled (no drives)
piixpm0 at pci0 dev 1 function 3 "Intel 82371AB Power" rev 0x03: apic 0 int 9
iic0 at piixpm0
vga1 at pci0 dev 2 function 0 "Red Hat QXL Video" rev 0x05
wsdisplay at vga1 not configured
virtio0 at pci0 dev 3 function 0 "Qumranet Virtio Network" rev 0x00
vio0 at virtio0: address 52:54:00:fb:e3:ca
virtio0: msix shared
azalia0 at pci0 dev 4 function 0 "Intel 82801FB HD Audio" rev 0x01: apic 0 int 11
azalia0: No codecs found
xhci0 at pci0 dev 5 function 0 vendor "Red Hat", unknown product 0x000d rev 0x01: apic 0 int 10, xHCI 0.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Red Hat xHCI root hub" rev 3.00/1.00 addr 1
virtio1 at pci0 dev 6 function 0 "Qumranet Virtio Console" rev 0x00
virtio1: no matching child driver; not configured
virtio2 at pci0 dev 7 function 0 "Qumranet Virtio Storage" rev 0x00
vioblk0 at virtio2
scsibus2 at vioblk0: 1 targets
sd0 at scsibus2 targ 0 lun 0: <VirtIO, Block Device, >
sd0: 20480MB, 512 bytes/sector, 41943040 sectors
virtio2: msix shared
virtio3 at pci0 dev 8 function 0 "Qumranet Virtio Memory Balloon" rev 0x00
viomb0 at virtio3
virtio3: apic 0 int 11
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0 mux 1
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT (using slow L1TF mitigation)
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
root on sd0a (0a3367c01791643f.a) swap on sd0b dump on sd0b

usbdevs:
Controller /dev/usb0:
addr 01: 1b36:0000 Red Hat, xHCI root hub
         super speed, self powered, config 1, rev 1.00
         driver: uhub0
addr 02: 0483:a2ca SoloKeys, Solo 4.1.1
         full speed, power 100 mA, config 1, rev 1.00, iSerial 123456789012
         driver: uhidev0

Reply | Threaded
Open this post in threaded view
|

Re: Possible binary incompatible change of struct usb_device_info in 2018

Stuart Henderson
On 2021/03/13 16:38, [hidden email] wrote:

> >Synopsis: Undocumented change of struct usb_device_info
> >Category: documentation kernel
> >Environment:
> System      : OpenBSD 6.8
> Details     : OpenBSD 6.8 (GENERIC.MP) #98: Sun Oct  4 18:13:26 MDT 2020
> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine     : amd64
> >Description:
> struct usb_device_info has been changed in sys/dev/usb/usb.h from version
> 1.59 to 1.60 on 2018-07-10 most probably resizing it and relocating its
> last member udi_serial in memory.

That is not unusual, OpenBSD doesn't have particularly stable ABIs.

>     This change is not documented in usb(4).

That needs fixing.

Index: usb.4
===================================================================
RCS file: /cvs/src/share/man/man4/usb.4,v
retrieving revision 1.205
diff -u -p -r1.205 usb.4
--- usb.4 4 Feb 2021 16:25:38 -0000 1.205
+++ usb.4 13 Mar 2021 16:19:14 -0000
@@ -431,9 +431,11 @@ struct usb_device_info {
  u_int8_t udi_protocol;
  u_int8_t udi_config;
  u_int8_t udi_speed;
-#define USB_SPEED_LOW  1
-#define USB_SPEED_FULL 2
-#define USB_SPEED_HIGH 3
+#define USB_SPEED_LOW 1
+#define USB_SPEED_FULL 2
+#define USB_SPEED_HIGH 3
+#define USB_SPEED_SUPER 4
+ u_int8_t udi_port;
  int udi_power; /* power consumption */
  int udi_nports;
  char udi_devnames[USB_MAX_DEVNAMES]

Reply | Threaded
Open this post in threaded view
|

Re: Possible binary incompatible change of struct usb_device_info in 2018

Todd C. Miller-3
On Sat, 13 Mar 2021 16:20:43 +0000, Stuart Henderson wrote:

> That needs fixing.

Also need to sync udi_ports[] which is now u_int32_t not u_int8_t.

 - todd

> Index: usb.4
> ===================================================================
> RCS file: /cvs/src/share/man/man4/usb.4,v
> retrieving revision 1.205
> diff -u -p -r1.205 usb.4
> --- usb.4 4 Feb 2021 16:25:38 -0000 1.205
> +++ usb.4 13 Mar 2021 16:19:14 -0000
> @@ -431,9 +431,11 @@ struct usb_device_info {
>   u_int8_t udi_protocol;
>   u_int8_t udi_config;
>   u_int8_t udi_speed;
> -#define USB_SPEED_LOW  1
> -#define USB_SPEED_FULL 2
> -#define USB_SPEED_HIGH 3
> +#define USB_SPEED_LOW 1
> +#define USB_SPEED_FULL 2
> +#define USB_SPEED_HIGH 3
> +#define USB_SPEED_SUPER 4
> + u_int8_t udi_port;
>   int udi_power; /* power consumption */
>   int udi_nports;
>   char udi_devnames[USB_MAX_DEVNAMES]
>

Reply | Threaded
Open this post in threaded view
|

Re: Possible binary incompatible change of struct usb_device_info in 2018

Stuart Henderson
On 2021/03/13 09:28, Todd C. Miller wrote:
> On Sat, 13 Mar 2021 16:20:43 +0000, Stuart Henderson wrote:
>
> > That needs fixing.
>
> Also need to sync udi_ports[] which is now u_int32_t not u_int8_t.

oh good catch, the USB_PORT_* defines have gone too. I'll fix that and commit.

Reply | Threaded
Open this post in threaded view
|

Re: Possible binary incompatible change of struct usb_device_info in 2018

Enrik Berkhan
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Sat, 2021-03-13 at 16:41 +0000, Stuart Henderson wrote:
> On 2021/03/13 09:28, Todd C. Miller wrote:
> > On Sat, 13 Mar 2021 16:20:43 +0000, Stuart Henderson wrote:
> >
> > > That needs fixing.
> >
> > Also need to sync udi_ports[] which is now u_int32_t not u_int8_t.
>
> oh good catch, the USB_PORT_* defines have gone too. I'll fix that and commit.
>

Thanks for fixing this!
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEbLyQBMI0qAWiF6l31AjqSkbLPKQFAmBUnUsACgkQ1AjqSkbL
PKSHJwv/eOYF0ukJQsCAn7P9//G7S9Ib2k24gbe7b4jNShpdjOJ38pYuhyBnix+2
P4OR4pXS7BWsYyAafKk+OwTTbmENOzt83VLhw1z9E+Kf5/A2I5vO53w3rMhWH8Kd
Cc+vJjzT81qgOwBOKvi1vvaaim8nzZnKnsjl2COcfTKH2weRyGn0XinI63LQ8DZc
p9uOq6+r5u2W0YBv+pYRmmGtRUpcAol/Nbhk3CGoHG+OX/wcqCKfVIGfq7FZqMuT
ogtA4Nu2SnTirGMj8ACm3Mzmr2jujjh7V3COY7wFbGuDgJ8TReg++GkBcCIjtNys
K+DNmmSxmd1vIQr0tHijS3n238AQ6HVnDJRe5u/DKJ6XI0QaStR2bK0bUcTXR6As
UxRMLHBBdjJN4v9zdnXwzXQ936tks6E0gSzL6GAOQgyZRw0cEaoLVp9c54krfx8d
Bi5IL7YdzrpB9g0VnpRPChd4gIu2yZ/sMFaWkTEVCuJKbYzatp9XE6hzX9QJoQeC
kPuJBzKH
=Z9Yy
-----END PGP SIGNATURE-----