[Libusbx-devel] Received ABORT_PIPE After calling libusb_handle_events_timeout

2012-08-02 Thread John Chen
Hi, Gurus, I am doing a Asynchronous Bulk call to USB, everything seems to work fine, but after I call the first libusb_handle_events_timeout, I Received ABORT_PIPE from USBTrace, After the second libusb_handle_events_timeout call, the callback receive the message. (no sure why I have to call li

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Orin Eman
On Thu, Aug 2, 2012 at 1:58 PM, Pete Batard wrote: > > > Setting next and prev to NULL in list_del() caused a crash in > > usbi_cond_destroy() in threads_windows.c (next was used after calling > > list_del). Using list_for_each_entry_safe fixed it and cleaned up the > code. > > > > int usbi_cond

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Pete Batard
On 2012.08.02 19:30, Orin Eman wrote: > I've seen the list get screwed up by trying to reissue a transfer > before getting the callback. The list got a circular segment in > that case. Perhaps something like cancelling a transfer followed by > freeing it before getting the callbac

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Orin Eman
On Thu, Aug 2, 2012 at 9:30 AM, Orin Eman wrote: > I've seen the list get screwed up by trying to reissue a transfer before > getting the callback. The list got a circular segment in that case. > Perhaps something like cancelling a transfer followed by freeing it before > getting the callback ca

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Orin Eman
I've seen the list get screwed up by trying to reissue a transfer before getting the callback. The list got a circular segment in that case. Perhaps something like cancelling a transfer followed by freeing it before getting the callback causes this? I made a couple of changes to trap this - I'll

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Pete Batard
On 2012.08.02 13:28, sebasti...@gmx-topmail.de wrote: > (gdb) print ((struct usbi_transfer*)0xb6600468)->list > $4 = {prev = 0x0, next = 0x0} This confirms that our list is screwed up and since we don't check for the next/prev validity, we end up with a NULL dereference (actually NULL-4), hence

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread sebastiank
> On 2012.08.02 14:08, sebastiank wrote: > (gdb) print (struct usbi_transfer)0xb6600468 > Invalid cast. For the first backtrace: #0 0x00697e9b in add_to_flying_list (transfer=0xb6600468) at io.c:1185 (gdb) print ((struct usbi_transfer*)0xb6600468)->num_iso_packets $1 = 0 (gdb) print ((struct us

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Pete Batard
On 2012.08.02 13:08, sebasti...@gmx-topmail.de wrote: > (gdb) print (struct usbi_transfer)0xb6600468 > Invalid cast. OK. Maybe it should have been print *(struct usbi_transfer*)0xb6600468, but if that doesn't work, don't worry. > For the first backtrace: > (gdb) x 0xb6600468 > 0xb6600468: 0x

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread sebastiank
> On 2012.08.02 13:58, Pete Batard wrote: > I think 'print (struct usbi_transfer)0xb6600468' should do but if that > doesn't work, the hex dump should do just fine. (gdb) print (struct usbi_transfer)0xb6600468 Invalid cast. For the first backtrace: (gdb) x 0xb6600468 0xb6600468: 0x (

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Pete Batard
On 2012.08.02 12:04, sebasti...@gmx-topmail.de wrote: > For the first backtrace: > (gdb) print &ctx->flying_transfers > $3 = (struct list_head *) 0x9088ed8 > > For the second backtrace: > (gdb) print &ctx->flying_transfers > $3 = (struct list_head *) 0x8b63ed8 Thanks. This confirms that our list

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread sebastiank
Hello Pete, please see the lines below. For the first backtrace: (gdb) print &ctx->flying_transfers $3 = (struct list_head *) 0x9088ed8 For the second backtrace: (gdb) print &ctx->flying_transfers $3 = (struct list_head *) 0x8b63ed8 = Regards Sebastian =

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Pete Batard
On 2012.08.02 11:34, Pete Batard wrote: > > (gdb) print ctx->flying_transfers > > $2 = {prev = 0xb660046c, next = 0xb660046c} > > Means that our circular list is pointing to itself (empty), so it all > looks like we got some list deletion between the initial list_empty() > check [1], that failed

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Pete Batard
> (gdb) print ctx->flying_transfers > $2 = {prev = 0xb660046c, next = 0xb660046c} Means that our circular list is pointing to itself (empty), so it all looks like we got some list deletion between the initial list_empty() check [1], that failed (i.e. list was not empty then), and the time we

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread sebastiank
For the first backtrace: (gdb) print *cur Cannot access memory at address 0xfffc (gdb) print *ctx $1 = {debug = 0, debug_fixed = 0, ctrl_pipe = {8, 9}, usb_devs = {prev = 0x9089010, next = 0x90899c0}, usb_devs_lock = {__data = {__lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0,

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Ludovic Rousseau
2012/8/2 : > Hello Ludovic, > >> On 2012.08.02 10:19, Ludovic Rousseau wrote: >> In gdb can you display the different variables using: > > This is the output for the first backtrace I send today: > #0 0x00697e9b in add_to_flying_list (transfer=0xb6600468) at io.c:1185 > 1185io.c: Datei oder V

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread sebastiank
Hello Ludovic, > On 2012.08.02 10:19, Ludovic Rousseau wrote: > In gdb can you display the different variables using: This is the output for the first backtrace I send today: #0 0x00697e9b in add_to_flying_list (transfer=0xb6600468) at io.c:1185 1185io.c: Datei oder Verzeichnis nicht gefunde

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread Ludovic Rousseau
2012/8/2 : >> On 2012.07.28 12:06, Ludovic Rousseau wrote: >> You would get more detailed information by rebuilding libusbx with debug >> info. > As you suggested, I compiled libusbx with debug info. Thanks. > I'd like you to have a final look at the attached backtrace and confirm > that the seg

Re: [Libusbx-devel] libusb segfaults - causes pcscd to crash

2012-08-02 Thread sebastiank
Just got another segmentation fault. The Backtrace differs from the previous one. = Regards Sebastian = gdb /usr/sbin/pcscd core GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later