Hi.

I was playing with libusb when my machine suddenly crashed.

The code below, run twice, should reproduce the problem on
i386 and amd64 with any ugen device attached, GENERIC and
GENERIC.MP.

$ cat bug.c # minimal error-checking
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <libusb-1.0/libusb.h>

/* Set to your ugen(4) device. */
#define PRODUCT 0x3b10
#define VENDOR 0x07d1

int
main(void)
{
    int n = 0;
    struct libusb_device_handle *h;

    libusb_init(NULL);
    h = libusb_open_device_with_vid_pid(NULL, VENDOR, PRODUCT);
    libusb_get_configuration(h, &n);
    printf("libusb_get_configuration -> %d\n", n);
    if ((n = libusb_set_configuration(h, 0)) < 0)
        printf("libusb_set_configuration -> %s\n", libusb_error_name(n));
    libusb_close(h);
    libusb_exit(NULL);
    return 0;
}
$ ./bug
libusb_get_configuration -> 1
libusb_set_configuration -> LIBUSB_ERROR_IO
$ ./bug
uvm_fault(0xffffffff81d47f00, 0x2, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at      usbd_get_cdesc+0x35:    movzwl   0x2(%rax),%eax
ddb{3}> trace
usbd_get_cdesc() at usbd_get_cdesc+0x35
usb_fill_udc_task() at usb_fill_udc_task+0x4c
usb_task_thread() at usb_task_thread+0xb2
end trace frame: 0x0, count: -3
ddb{3}>

I don't have a serial console on this machine so photos
(and code) is available at http://tp76.info/ugen-crash
for GENERIC and GENERIC.MP on amd64.

I was hoping I could narrow it down further, using ioctl's
rather than libusb, but my kernel debugging "skills" suck,
sorry.

Running Jan 24 snapshot (compiled kernel from latest source)

$ dmesg
OpenBSD 5.5-beta (GENERIC.MP) #43: Sun Feb  2 14:08:35 CET 2014
    tpf...@ws.tp76.info:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8515391488 (8120MB)
avail mem = 8280498176 (7896MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xeb8c0 (104 entries)
bios0: vendor American Megatrends Inc. version "2003" date 05/09/2013
bios0: ASUSTeK COMPUTER INC. P8Z77-V
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT MCFG HPET SSDT DMAR SSDT SSDT
acpi0: wakeup devices PS2M(S4) UAR1(S4) PS2K(S4) P0P1(S4) PXSX(S4) RP01(S4) 
PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP06(S4) 
PXSX(S4) RP07(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3310.17 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 100MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.0, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3309.72 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3309.72 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz, 3309.72 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus 2 (RP01)
acpiprt3 at acpi0: bus -1 (RP02)
acpiprt4 at acpi0: bus -1 (RP03)
acpiprt5 at acpi0: bus 3 (RP04)
acpiprt6 at acpi0: bus -1 (RP06)
acpiprt7 at acpi0: bus -1 (RP07)
acpiprt8 at acpi0: bus 6 (RP08)
acpiprt9 at acpi0: bus 1 (PEG0)
acpiprt10 at acpi0: bus -1 (PEG1)
acpiprt11 at acpi0: bus -1 (PEG2)
acpiprt12 at acpi0: bus -1 (PEG3)
acpiprt13 at acpi0: bus 4 (RP05)
acpiprt14 at acpi0: bus 5 (PXSX)
acpiec0 at acpi0
acpiec at acpi0 not configured
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpicpu2 at acpi0: C3, C2, C1, PSS
acpicpu3 at acpi0: C3, C2, C1, PSS
acpipwrres0 at acpi0: FN00, resource for FAN0
acpipwrres1 at acpi0: FN01, resource for FAN1
acpipwrres2 at acpi0: FN02, resource for FAN2
acpipwrres3 at acpi0: FN03, resource for FAN3
acpipwrres4 at acpi0: FN04, resource for FAN4
acpitz0 at acpi0: critical temperature is 106 degC
acpitz1 at acpi0: critical temperature is 106 degC
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibat2 at acpi0: BAT2 not present
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: LID0
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD02
cpu0: Enhanced SpeedStep 3310 MHz: speeds: 3301, 3300, 3200, 3100, 2900, 2800, 
2700, 2600, 2400, 2300, 2200, 2100, 2000, 1800, 1700, 1600 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 3G Host" rev 0x09
ppb0 at pci0 dev 1 function 0 "Intel Core 3G PCIE" rev 0x09: msi
pci1 at ppb0 bus 1
radeondrm0 at pci1 dev 0 function 0 "ATI Radeon HD 7850" rev 0x00
drm0 at radeondrm0
radeondrm0: msi
azalia0 at pci1 dev 0 function 1 vendor "ATI", unknown product 0xaab0 rev 0x00: 
msi
azalia0: no supported codecs
"Intel 7 Series xHCI" rev 0x04 at pci0 dev 20 function 0 not configured
"Intel 7 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured
em0 at pci0 dev 25 function 0 "Intel 82579V" rev 0x04: msi, address 
30:85:a9:41:bf:69
ehci0 at pci0 dev 26 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 16
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia1 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi
azalia1: codecs: Realtek/0x0892
audio0 at azalia1
ppb1 at pci0 dev 28 function 0 "Intel 7 Series PCIE" rev 0xc4: msi
pci2 at ppb1 bus 2
ppb2 at pci0 dev 28 function 3 "Intel 7 Series PCIE" rev 0xc4: msi
pci3 at ppb2 bus 3
ahci0 at pci3 dev 0 function 0 vendor "ASMedia", unknown product 0x0612 rev 
0x01: msi, AHCI 1.2
scsibus0 at ahci0: 32 targets
ppb3 at pci0 dev 28 function 4 "Intel 82801BA Hub-to-PCI" rev 0xc4: msi
pci4 at ppb3 bus 4
ppb4 at pci4 dev 0 function 0 "ASMedia ASM1083/1085 PCIE-PCI" rev 0x03
pci5 at ppb4 bus 5
puc0 at pci5 dev 1 function 0 "NetMos Nm9835" rev 0x01: ports: 1 com
com4 at puc0 port 0 apic 2 int 17: ns16550a, 16 byte fifo
com4: probed fifo depth: 0 bytes
ppb5 at pci0 dev 28 function 7 "Intel 7 Series PCIE" rev 0xc4: msi
pci6 at ppb5 bus 6
"ASMedia ASM1042 xHCI" rev 0x00 at pci6 dev 0 function 0 not configured
ehci1 at pci0 dev 29 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 23
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
pcib0 at pci0 dev 31 function 0 "Intel Z77 LPC" rev 0x04
ahci1 at pci0 dev 31 function 2 "Intel 7 Series AHCI" rev 0x04: msi, AHCI 1.3
scsibus1 at ahci1: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, INTEL SSDSC2CT12, 300i> SCSI3 0/direct 
fixed naa.5001517bb2940bf0
sd0: 114473MB, 512 bytes/sector, 234441648 sectors, thin
sd1 at scsibus1 targ 1 lun 0: <ATA, ST2000DM001-1CH1, CC43> SCSI3 0/direct 
fixed naa.5000c5004e19b4a4
sd1: 1907729MB, 512 bytes/sector, 3907029168 sectors
cd0 at scsibus1 targ 4 lun 0: <Optiarc, BD RW BD-5300S, 2.01> ATAPI 5/cdrom 
removable
ichiic0 at pci0 dev 31 function 3 "Intel 7 Series SMBus" rev 0x04: apic 2 int 18
iic0 at ichiic0
spdmem0 at iic0 addr 0x51: 4GB DDR3 SDRAM PC3-10600
spdmem1 at iic0 addr 0x53: 4GB DDR3 SDRAM PC3-10600
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
uhub2 at uhub0 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
uhidev0 at uhub2 port 5 configuration 1 interface 0 "Logitech USB-PS/2 Optical 
Mouse" rev 2.00/20.00 addr 3
uhidev0: iclass 3/1
ums0 at uhidev0: 3 buttons, Z dir
wsmouse0 at ums0 mux 0
uhub3 at uhub1 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (eb935830c22273bd.a) swap on sd0b dump on sd0b
drm: initializing kernel modesetting (PITCAIRN 0x1002:0x6819 0x1043:0x042C).
radeondrm0: VRAM: 2048M 0x0000000000000000 - 0x000000007FFFFFFF (2048M used)
radeondrm0: GTT: 512M 0x0000000080000000 - 0x000000009FFFFFFF
ttm_pool_mm_shrink_init stub
drm: PCIE GART of 512M enabled (table at 0x0000000000040000).
drm: Internal thermal controller with fan control
radeondrm0: 1680x1050
wsdisplay0 at radeondrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)

Reply via email to