Hi Ludovic,

I really appreciate your quick feedback.  I only hope I could have that
kind of quick response for bugreports against my own free software projects.

On Thu, Mar 24, 2011 at 10:59:36PM +0100, Ludovic Rousseau wrote:

> >So, as it seems, somehow, if openct is installed (and not running), pcscd 
> >will
> >not try to use its internal CCID driver?  Is this intentional?
> 
> openct also provides a ifd-handler for pcscd.

yes.

> So the problem may be the openct handler causing a NULL devpath. I
> will have a look.

actually, the devpath is resolved from libudev _before_ the ifdhandler is
even called.  So I would be surprised if openct somehow causes the problem.

> >After applying your patch _and_ removing openct (no
> >/usr/lib/pcsc/drivers/openct-ifd.bundle/Contents/Linux/openct-ifd.so present
> >anymore), I was able to make it work:
> 
> Can you also try _without_ the patch?

without openct installed, and without the patch, as expected, pcscd still
crashes at exactly the same location:

(gdb) run -f -a -d
Starting program: /usr/sbin/pcscd -f -a -d
[Thread debugging using libthread_db enabled]
00000000 debuglog.c:277:DebugLogSetLevel() debug level=debug
00000329 configfile.l:245:DBGetReaderListDir() Parsing conf directory: 
/etc/reader.conf.d
00000028 configfile.l:287:DBGetReaderList() Parsing conf file: 
/etc/reader.conf.d/libccidtwin
00000059 configfile.l:287:DBGetReaderList() Parsing conf file: 
/etc/reader.conf.d/0comments
00000047 pcscdaemon.c:550:main() pcsc-lite 1.7.0 daemon ready.
00001384 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0001, path: (null)
00000157 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0001, path: (null)
00000159 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0002, path: (null)
00000155 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0001, path: (null)
00000137 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0001, path: (null)
00000137 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0001, path: (null)
00000136 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0001, path: (null)
00000142 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x1D6B, PID: 0x0002, path: (null)
[New Thread 0x7f59e74ba700 (LWP 20165)]
04034678 hotplug_libudev.c:258:get_driver() Looking for a driver for VID: 
0x076B, PID: 0x3021, path: (null)
00000042 hotplug_libudev.c:309:HPAddDevice() Adding USB device: OmniKey CardMan 
3121

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f59e74ba700 (LWP 20165)]
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31
31      ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
        in ../sysdeps/x86_64/multiarch/../strlen.S
(gdb) bt full
#0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31
No locals.
#1  0x00007f59e7536856 in __strdup (s=0x0) at strdup.c:42
        len = <value optimized out>
#2  0x000000000040d502 in HPAddDevice (dev=<value optimized out>, parent=<value 
optimized out>, devpath=0x0)
    at hotplug_libudev.c:368
        i = 0
        deviceName = "usb:076b/3021:libudev:0:(null)", '\000' <repeats 26 
times>"\200, 
\064'\350Y\177\000\000\260\235K\347Y\177\000\000ȝK\347Y\177\000\000\000\000\000\000\001\000\000\000(\024@",
 '\000' <repeats 85 times>"\200, 
#\304\347Y\177\000\000p\t'\350Y\177\000\000\000\000\000\000\000\000\000\000\377\377\377\377",
 '\000' <repeats 12 times>, "\005\000\000\000\000\000\000\000\030\235a", '\000' 
<repeats 13 times>, "\020\327F\001\000\000\000\000\003\000\000\000\000\000"
        fullname = "OmniKey CardMan 3121", '\000' <repeats 20 times>"\200, 
#\304\347Y\177", '\000' <repeats 11 times>, 
"n+z\022\302\027\213\a\000\000\000\000\000\000\000\060\333F\001\000\000\000\000\060\333F\001\000\000\000\000&\\A\000\000\000\000\000
 \fG\001"
        driver = 0x14752b8
        sSerialNumber = <value optimized out>
        sInterfaceName = 0x0
        ret = <value optimized out>
        bInterfaceNumber = 0
        __FUNCTION__ = "HPAddDevice"
#3  0x000000000040d9bc in HPEstablishUSBNotifications (udev=0x1470c20) at 
hotplug_libudev.c:551
        dev = 0x146d710
        parent = 0x146db30
        action = <value optimized out>
        devpath = 0x146de50 "OmniKey CardMan 3121"
        udev_monitor = <value optimized out>
        r = <value optimized out>
        i = <value optimized out>
        __FUNCTION__ = "HPEstablishUSBNotifications"
#4  0x00007f59e78238ba in start_thread (arg=<value optimized out>) at 
pthread_create.c:300
        __res = <value optimized out>
        pd = 0x7f59e74ba700
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140024109311744, 
486541036462382269, 140736994234784, 
                140024109311744, 140024123695168, 3, -544015359995437891, 
-544014735935431491}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = 
{prev = 0x0, cleanup = 0x0, 
              canceltype = 0}}}
        not_first_call = <value optimized out>
        freesize = <value optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#5  0x00007f59e758a3cd in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
No locals.
#6  0x0000000000000000 in ?? ()
No symbol table info available.

> >So the patch seems to fix the segfault, but still the question remains: Why 
> >is
> >pcscd not using its internal CCID driver if OpenCT is installed (but not even
> >running) ?
> 
> pcscd has no _internal_ CCID driver. pcscd has no internal driver at all.

well I was meaning to say: "the CCID driver / ifd_handler that is shipping as
part of pcsc-lite"

So as a summary, I think there are still two separate, problems:

1) the fact that pcscd does not handle the case that devpath == NULL,
   which can be worked around using your patch

2) the question why pcscd is trying to use _only_ the OpenCT ifd_handler,
   even when openct is not started (which it detects!)

and maybe even a third one:

3) why does libudev sometimes not provide a devpath in the first place.

Regards,
        Harald
-- 
- Harald Welte <lafo...@gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to