On Mon, May 14, 2012 at 11:24 PM, Pete Batard <p...@akeo.ie> wrote: > On 2012.05.14 14:16, Xiaofan Chen wrote: >> Somehow xusb now segfaults sometimes. > > It seems to segfault when retrieving the topological data on Mac, which > of course explains why 1.0.11 is fine. > > [ 0.913785] [00001307] libusbx: info [darwin_check_configuration] > active config: 1, first config: 1 > > Program received signal EXC_BAD_ACCESS, Could not access memory. > Reason: 13 at address: 0x0000000000000000 > 0x000000010000ae96 in process_new_device [inlined] () at > /Users/xiaofanc/work/libusbx/libusbx/libusb/os/darwin_usb.c:767 > 767 if (parent_priv->location == parent_location) { > (gdb) bt > #0 0x000000010000ae96 in process_new_device [inlined] () at > /Users/xiaofanc/work/libusbx/libusbx/libusb/os/darwin_usb.c:767 > #1 0x000000010000ae96 in darwin_get_device_list (ctx=0x7fff5fbff660, > _discdevs=0x7fff5fbff660) at darwin_usb.c:829 > #2 0x000000010000227a in libusb_get_device_list (ctx=0x0, > list=0x7fff5fbff6b0) at core.c:603 > #3 0x0000000100002d72 in libusb_get_port_path (ctx=0x10010a040, > dev=0x100603a40, path=0x7fff5fbff83f "", path_len=8 '\b') at > core.c:688 > #4 0x000000010000d6e2 in test_device () > #5 0x000000010000e7db in main () > (gdb) quit > The program is running. Exit anyway? (y or n) y > > Most likely parent_priv/parent->os_priv is NULL here for one reason or > another. At first glance, this looks more like a backend implementation > issue. I haven't observed such a segfault when testing on Mac, but I > haven't performed extended tests there. > > In case this matters, how many hubs does your device go through before > the HCD? And when you say "sometimes", is there anything special you do > to make the segfault happen?
One external USB hub. Nothing special to reproduce. You got 50% chance of segfaults running the same command again and again. The following is for the Generic HID firmware. mymacmini:example1 xiaofanc$ lsusb Bus 250 Device 001: ID 05ac:8006 Apple, Inc. Bus 250 Device 002: ID 0424:2513 Standard Microsystems Corp. Bus 250 Device 004: ID 04f2:0760 Chicony Electronics Co., Ltd Acer KU-0760 Keyboard Bus 250 Device 005: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub Bus 250 Device 007: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 250 Device 009: ID 046d:c054 Logitech, Inc. Bus 250 Device 006: ID 0416:5518 Winbond Electronics Corp. 4-Port Hub Bus 250 Device 010: ID 0925:7001 Lakeview Research Bus 253 Device 001: ID 05ac:8006 Apple, Inc. Bus 253 Device 002: ID 0424:2513 Standard Microsystems Corp. Bus 253 Device 003: ID 05ac:8242 Apple, Inc. IR Receiver [built-in] Bus 253 Device 004: ID 0ac8:3420 Z-Star Microelectronics Corp. Venus USB2.0 Camera mymacmini:example1 xiaofanc$ ./xusb -d 0925:7001 Using libusbx v1.0.11.10505 Opening device... [timestamp] [threadID] facility level [function call] <message> -------------------------------------------------------------------------------- [ 0.000000] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa000000 [ 0.000082] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.000097] [00000707] libusbx: info [process_new_device] found device with address 1 port = 0 parent = 0x7fe60b504038 at 0x0 [ 0.000621] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa100000 [ 0.000855] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.000880] [00000707] libusbx: info [process_new_device] found device with address 2 port = 1 parent = 0x7fe60b5033c8 at 0x7fe60b503fa0 [ 0.001461] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa110000 [ 0.190047] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa120000 [ 0.191206] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.191234] [00000707] libusbx: info [process_new_device] found device with address 4 port = 2 parent = 0x10dd0bb98 at 0x7fe60b503330 [ 0.191971] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa130000 [ 0.192332] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.192367] [00000707] libusbx: info [process_new_device] found device with address 5 port = 3 parent = 0x10dd0bc58 at 0x7fe60b503330 [ 0.193146] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa113000 [ 0.381381] [00000707] libusbx: warning [darwin_cache_device_descriptor] could not retrieve device descriptor 05ac:8281: device not responding. skipping device [ 0.382427] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa131000 [ 0.383217] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.383246] [00000707] libusbx: info [process_new_device] found device with address 6 port = 1 parent = 0x7fe60b5040f8 at 0x10dd0bbc0 [ 0.384007] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa132000 [ 0.384629] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.384656] [00000707] libusbx: info [process_new_device] found device with address 7 port = 2 parent = 0x7fe60b503278 at 0x10dd0bbc0 [ 0.385381] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa133000 [ 0.386392] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.386417] [00000707] libusbx: info [process_new_device] found device with address 9 port = 3 parent = 0x10dd0bd58 at 0x10dd0bbc0 [ 0.386974] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd000000 [ 0.387025] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.387038] [00000707] libusbx: info [process_new_device] found device with address 1 port = 0 parent = 0x10dd0be18 at 0x0 [ 0.387690] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd100000 [ 0.387934] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.387990] [00000707] libusbx: info [process_new_device] found device with address 2 port = 1 parent = 0x10dd0bed8 at 0x10dd0bd80 [ 0.388566] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd110000 [ 0.534560] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.534631] [00000707] libusbx: info [process_new_device] found device with address 3 port = 1 parent = 0x7fe60b600278 at 0x10dd0be40 [ 0.535509] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd130000 [ 0.536235] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.536263] [00000707] libusbx: info [process_new_device] found device with address 4 port = 3 parent = 0x7fe60b503488 at 0x10dd0be40 [ 0.538160] [00000707] libusbx: info [darwin_open] device open for access [ 0.539289] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa000000 [ 0.539342] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.539353] [00000707] libusbx: info [process_new_device] found device with address 1 port = 0 parent = 0x7fe60b504038 at 0x0 [ 0.539911] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa100000 [ 0.540253] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.540271] [00000707] libusbx: info [process_new_device] found device with address 2 port = 1 parent = 0x7fe60b503278 at 0x7fe60b503fa0 [ 0.540708] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa110000 [ 0.727575] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa120000 [ 0.728704] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.728732] [00000707] libusbx: info [process_new_device] found device with address 4 port = 2 parent = 0x10dd0bb98 at 0x7fe60b5031e0 [ 0.729506] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa130000 [ 0.729946] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.729972] [00000707] libusbx: info [process_new_device] found device with address 5 port = 3 parent = 0x10dd0bc98 at 0x7fe60b5031e0 [ 0.730774] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa113000 [ 0.917860] [00000707] libusbx: warning [darwin_cache_device_descriptor] could not retrieve device descriptor 05ac:8281: device not responding. skipping device [ 0.918974] [00000707] libusbx: info [process_new_device] using existing device for location 0xfa131000 [ 0.919651] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.919679] [00000707] libusbx: info [process_new_device] found device with address 6 port = 1 parent = 0x7fe60b5040f8 at 0x10dd0bc00 [ 0.920389] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa132000 [ 0.921114] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.921146] [00000707] libusbx: info [process_new_device] found device with address 7 port = 2 parent = 0x7fe60b504398 at 0x10dd0bc00 [ 0.921877] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa133000 [ 0.922721] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.922739] [00000707] libusbx: info [process_new_device] found device with address 9 port = 3 parent = 0x7fe60b503458 at 0x10dd0bc00 [ 0.923257] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd000000 [ 0.923308] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.923320] [00000707] libusbx: info [process_new_device] found device with address 1 port = 0 parent = 0x7fe60b5036f8 at 0x0 [ 0.923883] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd100000 [ 0.924045] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.924072] [00000707] libusbx: info [process_new_device] found device with address 2 port = 1 parent = 0x7fe60b504458 at 0x7fe60b503660 [ 0.924686] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd110000 [ 1.071491] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 1.071522] [00000707] libusbx: info [process_new_device] found device with address 3 port = 1 parent = 0x10dd0bed8 at 0x7fe60b5043c0 [ 1.072078] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd130000 [ 1.072591] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 1.072605] [00000707] libusbx: info [process_new_device] found device with address 4 port = 3 parent = 0x7fe60b5037b8 at 0x7fe60b5043c0 bus: 250, port path from HCD: 1->3->1 speed: 12 Mbit/s (USB 1.0 FullSpeed) Reading device descriptor: length: 18 device class: 0 S/N: 0 VID:PID: 0925:7001 bcdDevice: 0001 iMan:iProd:iSer: 1:2:0 nb confs: 1 Reading configuration descriptors: nb interfaces: 1 interface[0]: id = 0 interface[0].altsetting[0]: num endpoints = 2 Class.SubClass.Protocol: 03.00.00 endpoint[0].address: 81 max packet size: 0040 polling interval: 01 endpoint[1].address: 01 max packet size: 0040 polling interval: 01 Claiming interface 0... [ 1.073246] [00000707] libusbx: error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access Failed. Reading string descriptors: [ 1.195752] [00001607] libusbx: info [darwin_async_io_callback] an async io operation has completed [ 1.195842] [00000707] libusbx: info [op_handle_events] checking fd 4 with revents = 0 [ 1.195875] [00000707] libusbx: info [op_handle_events] checking fd 6 with revents = 1 [ 1.195898] [00000707] libusbx: info [darwin_handle_callback] handling control completion with kernel status 0 [ 1.196675] [00001607] libusbx: info [darwin_async_io_callback] an async io operation has completed [ 1.196738] [00000707] libusbx: info [op_handle_events] checking fd 4 with revents = 0 [ 1.196760] [00000707] libusbx: info [op_handle_events] checking fd 6 with revents = 1 [ 1.196775] [00000707] libusbx: info [darwin_handle_callback] handling control completion with kernel status 0 String (0x01): "Lakeview Research" [ 1.197139] [00001607] libusbx: info [darwin_async_io_callback] an async io operation has completed [ 1.197186] [00000707] libusbx: info [op_handle_events] checking fd 4 with revents = 0 [ 1.197214] [00000707] libusbx: info [op_handle_events] checking fd 6 with revents = 1 [ 1.197239] [00000707] libusbx: info [darwin_handle_callback] handling control completion with kernel status 0 [ 1.197906] [00001607] libusbx: info [darwin_async_io_callback] an async io operation has completed [ 1.197969] [00000707] libusbx: info [op_handle_events] checking fd 4 with revents = 0 [ 1.197993] [00000707] libusbx: info [op_handle_events] checking fd 6 with revents = 1 [ 1.198016] [00000707] libusbx: info [darwin_handle_callback] handling control completion with kernel status 0 String (0x02): "Generic HID" [ 1.198410] [00001607] libusbx: info [darwin_async_io_callback] an async io operation has completed [ 1.198454] [00000707] libusbx: info [op_handle_events] checking fd 4 with revents = 0 [ 1.198477] [00000707] libusbx: info [op_handle_events] checking fd 6 with revents = 1 [ 1.198500] [00000707] libusbx: info [darwin_handle_callback] handling control completion with kernel status 0 [ 1.198751] [00001607] libusbx: info [darwin_async_io_callback] an async io operation has completed [ 1.198798] [00000707] libusbx: info [op_handle_events] checking fd 4 with revents = 0 [ 1.198815] [00000707] libusbx: info [op_handle_events] checking fd 6 with revents = 1 [ 1.198830] [00000707] libusbx: info [darwin_handle_callback] handling control completion with kernel status -536854449 [ 1.198840] [00000707] libusbx: warning [darwin_transfer_status] transfer error: pipe is stalled Releasing interface 0... Closing device... [ 1.199213] [00001607] libusbx: info [event_thread_main] thread exiting mymacmini:example1 xiaofanc$ ./xusb -d 0925:7001 Using libusbx v1.0.11.10505 Opening device... [timestamp] [threadID] facility level [function call] <message> -------------------------------------------------------------------------------- [ 0.000000] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa000000 [ 0.000069] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.000082] [00000707] libusbx: info [process_new_device] found device with address 1 port = 0 parent = 0x105c0e298 at 0x0 [ 0.000696] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa100000 [ 0.000908] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.000923] [00000707] libusbx: info [process_new_device] found device with address 2 port = 1 parent = 0x105c0d628 at 0x105c0e200 [ 0.001337] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa110000 [ 0.188427] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa120000 [ 0.189847] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.189890] [00000707] libusbx: info [process_new_device] found device with address 4 port = 2 parent = 0x105c0d6e8 at 0x105c0d590 [ 0.190728] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa130000 [ 0.191208] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.191230] [00000707] libusbx: info [process_new_device] found device with address 5 port = 3 parent = 0x7f8428401a88 at 0x105c0d590 [ 0.191928] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa113000 [ 0.380046] [00000707] libusbx: warning [darwin_cache_device_descriptor] could not retrieve device descriptor 05ac:8281: device not responding. skipping device [ 0.381110] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa131000 [ 0.381811] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.381841] [00000707] libusbx: info [process_new_device] found device with address 6 port = 1 parent = 0x7f8428600098 at 0x7f84284019f0 [ 0.382577] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa132000 [ 0.383455] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.383484] [00000707] libusbx: info [process_new_device] found device with address 7 port = 2 parent = 0x7f8428600158 at 0x7f84284019f0 [ 0.384150] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa133000 [ 0.385087] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.385109] [00000707] libusbx: info [process_new_device] found device with address 9 port = 3 parent = 0x7f8428600258 at 0x7f84284019f0 [ 0.385583] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd000000 [ 0.385634] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.385645] [00000707] libusbx: info [process_new_device] found device with address 1 port = 0 parent = 0x7f8428600318 at 0x0 [ 0.386121] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd100000 [ 0.386286] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.386322] [00000707] libusbx: info [process_new_device] found device with address 2 port = 1 parent = 0x7f84286003d8 at 0x7f8428600280 [ 0.386941] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd110000 [ 0.533447] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.533484] [00000707] libusbx: info [process_new_device] found device with address 3 port = 1 parent = 0x105c0e028 at 0x7f8428600340 [ 0.534180] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfd130000 [ 0.534761] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 [ 0.534786] [00000707] libusbx: info [process_new_device] found device with address 4 port = 3 parent = 0x7f8428401978 at 0x7f8428600340 [ 0.536200] [00000707] libusbx: info [darwin_open] device open for access [ 0.537210] [00000707] libusbx: info [process_new_device] allocating new device for location 0xfa000000 [ 0.537255] [00000707] libusbx: info [darwin_check_configuration] active config: 1, first config: 1 Segmentation fault: 11 > While I'll see if I can reproduce the issue, we may also want Nathan > involved on that one, as he's the one who did the topology > implementation on Darwin... -- Xiaofan ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel