---------- Forwarded message ----------
From: Lars Kanis <[email protected]>
Date: Wed, Jun 6, 2012 at 5:23 PM
Subject: Segfault on win32
To: [email protected]


Hi libusb hackers,

I maintain the libusb-1.0-binding for Ruby (
https://github.com/larskanis/libusb ). The precompiled version for
Windows is built from libusb-1.0.9 sources with 32 bit version of
mingw-w64-2.0.1 and gcc-4.6.3 on Ubuntu 12.04. Recently I noticed two
issues, I would like to discuss.

1.
With gcc-4.6 the option -fomit-frame-pointer is turned on per default
even for the win32 target. This results in segfaults for any
application using setjmp/longjmp on WinXP (See
http://gcc.gnu.org/ml/gcc/2011-10/msg00351.html ) using the
libusb-1.0.dll. Since Ruby is using setjmp/longjmp for exception
handling, the used libusb-1.0.dll needs to be compiled with
-fno-omit-frame-pointer explicitly. Possibly it makes sense to enforce
the flag in libusb's configure?

2.
The files windows_usb.c and poll_windows.c contain several log
statements which use the usbi_default_context. It will crash any
program which does not use the default context, but an explicit
context for libusb_init(). Is this a bug or a feature?

In my case the warning about "cancel from another thread" is correct,
but the reaction shouldn't be that hard:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2456]
0x6b602afa in usbi_log_v (ctx=0x0, level=LOG_LEVEL_WARNING,
function=0x6b612c79 "cancel_io", format=0x6b612a90 "Unable to cancel
I/O that was started from another thread", args=0x953fd10
"\340eak\347\003") at core.c:1763
1763            if (!ctx->debug)
(gdb) bt
#0  0x6b602afa in usbi_log_v (ctx=0x0, level=LOG_LEVEL_WARNING,
function=0x6b612c79 "cancel_io", format=0x6b612a90 "Unable to cancel
I/O that was started from another thread", args=0x953fd10
"\340eak\347\003") at core.c:1763
#1  0x6b602cab in usbi_log (ctx=0x0, level=LOG_LEVEL_WARNING,
function=0x6b612c79 "cancel_io", format=0x6b612a90 "Unable to cancel
I/O that was started from another thread") at core.c:1819
#2  0x6b605ee5 in cancel_io (_index=2) at os/poll_windows.c:117
#3  0x6b606914 in _free_index (_index=2) at os/poll_windows.c:397
#4  0x6b606a5e in usbi_free_fd (fd=7) at os/poll_windows.c:430
#5  0x6b60c1f7 in windows_clear_transfer_priv (itransfer=0x5092460) at
os/windows_usb.c:1750
#6  0x6b60c65a in windows_transfer_callback (itransfer=0x5092460,
io_result=0, io_size=0) at os/windows_usb.c:1903
#7  0x6b60c6a8 in windows_handle_callback (itransfer=0x5092460,
io_result=0, io_size=0) at os/windows_usb.c:1916
#8  0x6b60c846 in windows_handle_events (ctx=0x5064f80, fds=0x50af270,
nfds=2, num_ready=0) at os/windows_usb.c:1970
#9  0x6b604fdb in handle_events (ctx=0x5064f80, tv=0x953fed4) at io.c:1944
#10 0x6b605132 in libusb_handle_events_timeout_completed@12
(ctx=0x5064f80, tv=0x953ff08, completed=0x0) at io.c:2024
#11 0x6b605232 in libusb_handle_events@4 (ctx=0x5064f80) at io.c:2100
#12 0x657d1ea7 in ?? ()
#13 0x657d18ec in ?? ()
#14 0x657c7d9f in ?? ()
#15 0x657cf6e3 in ?? ()
#16 0x7c80b729 in ?? ()
#17 0x00000000 in ?? ()

--
Regards,
Lars Kanis

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to