2009/6/24 Emmanuel Deloget <[email protected]>:
> ... And I truely don't get it.
>
> The SIGSEGV happens from time to time when I replace the driver I'm
> developping with a new version of it. I use sudo pcscd -f -d -a as a command
> line to launch the daemon. Here is the backtrace I get from gdb (including a
> few debug lines that comes right before) :
>
> ------------------------>8----------------------------------------
>
> 00000033 hotplug_libhal.c:342:HPAddDevice() Adding USB device:
> usb_device_aaa_bbbb_01234567890123_if0
> 01001148 readerfactory.c:1024:RFInitializeReader() Attempting startup of
> XXXYYYY (01234567890123) 00 00 using
> /usr/local/pcsc/drivers/xxxyyyy.bundle/Contents/Linux/libifd_xxxyyyy.so
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb7c1ab90 (LWP 11390)]
> 0xb7fbfc21 in ?? () from /lib/ld-linux.so.2
> (gdb) bt
> #0  0xb7fbfc21 in ?? () from /lib/ld-linux.so.2
> #1  0xb7fc00ad in ?? () from /lib/ld-linux.so.2
> #2  0xb7fc02bf in ?? () from /lib/ld-linux.so.2
> #3  0xb7ef7d04 in ?? () from /lib/tls/i686/cmov/libc.so.6
> #4  0xb7ef80fa in _dl_sym () from /lib/tls/i686/cmov/libc.so.6
> #5  0xb7f9edb8 in ?? () from /lib/tls/i686/cmov/libdl.so.2
> #6  0xb7fc5036 in ?? () from /lib/ld-linux.so.2
> #7  0xb7f9f01c in ?? () from /lib/tls/i686/cmov/libdl.so.2
> #8  0xb7f9ed43 in dlsym () from /lib/tls/i686/cmov/libdl.so.2
> #9  0x0804c75a in DYN_GetAddress (pvLHandle=0x9e3d918, pvFHandle=0x0,
> pcFunction=0xb7fd3cc0 "") at dyn_unix.c:72
> #10 0x08050a92 in RFBindFunctions (rContext=0x9e31008) at
> readerfactory.c:763
> #11 0x08051588 in RFInitializeReader (rContext=0x9e31008) at
> readerfactory.c:1035
> #12 0x080520fe in RFAddReader (lpcReader=0x9e34370 "XXXYYYY
> (01234567890123)", dwPort=2097152,
>   lpcLibrary=0x9e34c30
> "/usr/local/pcsc/drivers/xxxyyyy.bundle/Contents/Linux/libifd_xxxyyyy.so",
>   lpcDevice=0xb7c1a045
> "usb:0aaa/bbbb:libhal:/org/freedesktop/Hal/devices/usb_device_aaa_bbbb_01234567890123_if0")
> at readerfactory.c:229
> #13 0x0804d91a in HPAddDevice (ctx=0x9e3e140, udi=0x9e3fa9c
> "/org/freedesktop/Hal/devices/usb_device_aaa_bbb_01234567890123_if0") at
> hotplug_libhal.c:393
> #14 0xb7f98749 in ?? () from /usr/lib/libhal.so.1
> #15 0xb7f610d5 in dbus_connection_dispatch () from /lib/libdbus-1.so.3
> #16 0xb7f61527 in ?? () from /lib/libdbus-1.so.3
> #17 0x0804d486 in HPEstablishUSBNotifications () at hotplug_libhal.c:236
> #18 0xb7f404ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #19 0xb7ebb49e in clone () from /lib/tls/i686/cmov/libc.so.6
> (gdb)
>
>
> ---------------------8<---------------------------------------------
>
> I changed a few string (like vid/pid, product name) that don't have much
> interest. The real issue can be seen on lines #9 abd #10 of this backtrace.
>  I use v1.5.3 of libpcsclite, and here is the code of readerfactory.c at
> line 749--765 ; line 763 begins with "rv2 = ":
>
> LONG RFBindFunctions(PREADER_CONTEXT rContext)
> {
>   int rv1, rv2, rv3;
>   void *f;
>
>   /*
>    * Use this function as a dummy to determine the IFD Handler version
>    * type  1.0/2.0/3.0.  Suppress error messaging since it can't be 1.0,
>    * 2.0 and 3.0.
>    */
>
>   DebugLogSuppress(DEBUGLOG_IGNORE_ENTRIES);
>
>   rv1 = DYN_GetAddress(rContext->vHandle, &f, "IO_Create_Channel");
>   rv2 = DYN_GetAddress(rContext->vHandle, &f, "IFDHCreateChannel");
>   rv3 = DYN_GetAddress(rContext->vHandle, &f, "IFDHCreateChannelByName");
>
>   DebugLogSuppress(DEBUGLOG_LOG_ENTRIES);
>
> Clearly, there is no way to have DYN_GetAddress() called with pvFHandle set
> to NULL and pcFunction set to an empty string. After that, getting a
> segfault in dlsym() because we feed it with an empty function name can be
> understood (I'm stretching my mind here ; in an ideal world, this should
> never SIGSEGV).
>
> I suppose that the problem happens before, when the dynamic library is
> loaded. It seems that something is corrupted somewhere, but this is
> difficult to see and even more difficult to prove. This can be a problem
> with the dynamic loader on my machine (uname --all: Linux 53JBD2J
> 2.6.27-11-generic #1 SMP Wed Apr 1 20:57:48 UTC 2009 i686 GNU/Linux ; that's
> an Ubuntu 9.04) although I suspect this can happen on other machines as
> well.
>
> Unfortunately, I don't have much time to investigate this problem, so I
> can't come with a solution. Although it's a bit annoying, it's not that
> blocking for me, as a restart of the daemon fixes everything. I repeat, the
> problem occurs only when I replace my dynamic library with a new version of
> itself (and sometimes it doesn't SIGSEGV).
>
> If you need more information, please tell me. I'm following the mailing list
> quite closely these days.

I would say it is a bug in your driver (but that is strange since no
code from it is executed yet), or a bug from the dynamic linker.

Does the crash happen the first time the driver is loaded? or after
you unplugged/replugged the reader?

You can try different things:
- install a debug version of the libc and try again to have more debug info
- dlsym() your driver in a sample code to try reproducing the bug

bye

-- 
 Dr. Ludovic Rousseau

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to