Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#812087: pcscd takes 100 % cpu each time I insert a mass storage USB key

52 views
Skip to first unread message

Eric Valette

unread,
Jan 20, 2016, 7:20:03 AM1/20/16
to
Package: pcscd
Version: 1.8.15-1
Severity: critical
Justification: breaks unrelated software

Twice in two days, I noticed my laptop fan was going carsy allthough I
was only doing many mail activity.

Twice I found that pcscd was eating a complete CPU and remembered that
each time I had inserted a regular mass storage USB key (two different keys)
not my crypto key.

-----------------------------------------------------
top - 12:56:25 up 3:14, 5 users, load average: 2.03, 1.56, 1.31
Tasks: 242 total, 2 running, 239 sleeping, 0 stopped, 1 zombie
%Cpu(s): 34.1 us, 21.1 sy, 0.0 ni, 44.8 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 8219052 total, 3472188 free, 2336828 used, 2410036 buff/cache
KiB Swap: 16383996 total, 16383996 free, 0 used. 5812264 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1687 root 20 0 394560 2916 2120 S 100.3 0.0 147:37.75 pcscd
14477 ceva6380 20 0 424288 57364 37792 R 99.7 0.7 2:59.83 konsole
2921 ceva6380 20 0 1410776 448992 87860 S 15.9 5.5 6:48.46 icedove
4463 ceva6380 20 0 1435116 363080 97112 S 1.7 4.4 4:12.69 iceweasel

-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.4.0 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF8, LC_CTYPE=en_US.UTF8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages pcscd depends on:
ii init-system-helpers 1.25
ii libc6 2.22-0experimental1
ii libccid [pcsc-ifd-handler] 1.4.22-1
ii libpcsclite1 1.8.15-1
ii libudev1 228-4
ii lsb-base 9.20160110

pcscd recommends no packages.

Versions of packages pcscd suggests:
ii systemd 228-4

-- no debconf information

eric2....@orange.com

unread,
Jan 20, 2016, 8:20:04 AM1/20/16
to
On 01/20/2016 01:31 PM, Ludovic Rousseau wrote:
> Do you have some pcscd related logs in /var/log/* ?
>
> Bye
>

Note that in the laptop there is a build in broadcom credit card format
crypto key reader (that you see in the log), but I do not use it
although for testing purpose I have enabled the driver. But the bug is
only if I insert a USB key.




daemon.log:Jan 18 15:17:11 r-x-ceva6380 pcscd[11283]: 00000000
ifdhandler.c:144:CreateChannelByNameOrChannel() failed
daemon.log:Jan 18 15:17:11 r-x-ceva6380 pcscd[11283]: 00000032
readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed
(usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
daemon.log:Jan 18 15:17:11 r-x-ceva6380 pcscd[11283]: 00000004
readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH]
(0123456789ABCD) init failed.
daemon.log:Jan 19 13:52:56 r-x-ceva6380 pcscd[1604]: 00000000
ifdhandler.c:144:CreateChannelByNameOrChannel() failed
daemon.log:Jan 19 13:52:56 r-x-ceva6380 pcscd[1604]: 00000027
readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed
(usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
daemon.log:Jan 19 13:52:56 r-x-ceva6380 pcscd[1604]: 00000005
readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH]
(0123456789ABCD) init failed.
daemon.log:Jan 20 09:42:05 r-x-ceva6380 pcscd[1687]: 00000000
ifdhandler.c:144:CreateChannelByNameOrChannel() failed
daemon.log:Jan 20 09:42:05 r-x-ceva6380 pcscd[1687]: 00000026
readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed
(usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
daemon.log:Jan 20 09:42:05 r-x-ceva6380 pcscd[1687]: 00000004
readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH]
(0123456789ABCD) init failed.
daemon.log:Jan 20 12:56:47 r-x-ceva6380 systemd[1]: pcscd.service: Main
process exited, code=killed, status=9/KILL
daemon.log:Jan 20 12:56:47 r-x-ceva6380 systemd[1]: pcscd.service: Unit
entered failed state.
daemon.log:Jan 20 12:56:47 r-x-ceva6380 systemd[1]: pcscd.service:
Failed with result 'signal'. <==== killed it by kill -9 to get CPU back
daemon.log:Jan 20 12:56:47 r-x-ceva6380 pcscd[14663]: 00000000
ifdhandler.c:144:CreateChannelByNameOrChannel() failed
daemon.log:Jan 20 12:56:47 r-x-ceva6380 pcscd[14663]: 00000022
readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed
(usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
daemon.log:Jan 20 12:56:47 r-x-ceva6380 pcscd[14663]: 00000003
readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH]
(0123456789ABCD) init failed.


-- eric



_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.

Ludovic Rousseau

unread,
Jan 20, 2016, 9:10:04 AM1/20/16
to
Le 20/01/2016 14:02, eric2....@orange.com a écrit :
> Note that in the laptop there is a build in broadcom credit card format crypto key reader (that you see in the log), but I do not use it although for testing purpose I have enabled the driver. But the bug is only if I insert a USB key.
>
>
>
>
> daemon.log:Jan 18 15:17:11 r-x-ceva6380 pcscd[11283]: 00000000 ifdhandler.c:144:CreateChannelByNameOrChannel() failed
> daemon.log:Jan 18 15:17:11 r-x-ceva6380 pcscd[11283]: 00000032 readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed (usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
> daemon.log:Jan 18 15:17:11 r-x-ceva6380 pcscd[11283]: 00000004 readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH] (0123456789ABCD) init failed.
> daemon.log:Jan 19 13:52:56 r-x-ceva6380 pcscd[1604]: 00000000 ifdhandler.c:144:CreateChannelByNameOrChannel() failed
> daemon.log:Jan 19 13:52:56 r-x-ceva6380 pcscd[1604]: 00000027 readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed (usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
> daemon.log:Jan 19 13:52:56 r-x-ceva6380 pcscd[1604]: 00000005 readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH] (0123456789ABCD) init failed.
> daemon.log:Jan 20 09:42:05 r-x-ceva6380 pcscd[1687]: 00000000 ifdhandler.c:144:CreateChannelByNameOrChannel() failed
> daemon.log:Jan 20 09:42:05 r-x-ceva6380 pcscd[1687]: 00000026 readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed (usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
> daemon.log:Jan 20 09:42:05 r-x-ceva6380 pcscd[1687]: 00000004 readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH] (0123456789ABCD) init failed.
> daemon.log:Jan 20 12:56:47 r-x-ceva6380 systemd[1]: pcscd.service: Main process exited, code=killed, status=9/KILL
> daemon.log:Jan 20 12:56:47 r-x-ceva6380 systemd[1]: pcscd.service: Unit entered failed state.
> daemon.log:Jan 20 12:56:47 r-x-ceva6380 systemd[1]: pcscd.service: Failed with result 'signal'. <==== killed it by kill -9 to get CPU back
> daemon.log:Jan 20 12:56:47 r-x-ceva6380 pcscd[14663]: 00000000 ifdhandler.c:144:CreateChannelByNameOrChannel() failed
> daemon.log:Jan 20 12:56:47 r-x-ceva6380 pcscd[14663]: 00000022 readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed (usb:0a5c/5800:libudev:0:/dev/bus/usb/002/004)
> daemon.log:Jan 20 12:56:47 r-x-ceva6380 pcscd[14663]: 00000003 readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH] (0123456789ABCD) init failed.

It does not look like the problem is the Broadcom reader.

Can you generate a log as documented in https://pcsclite.alioth.debian.org/pcsclite.html#support ?
Start the log and then connect your problematic mass-storage USB key.

Thanks

--
Dr. Ludovic Rousseau

Ludovic Rousseau

unread,
Jan 22, 2016, 9:10:03 AM1/22/16
to
Le 22/01/2016 13:11, eric2....@orange.com a écrit :
> On 01/20/2016 03:07 PM, Ludovic Rousseau wrote:
>>
>> It does not look like the problem is the Broadcom reader.
>>
>> Can you generate a log as documented in https://pcsclite.alioth.debian.org/pcsclite.html#support ?
>> Start the log and then connect your problematic mass-storage USB key.
>>
>> Thanks
>>
>
> Here is the requested log file. Note that I'm not sure the trace will help:
> 1) As soon as I launch it, I have continuous traces but process does not even appaers in the top first twenty line,

You have 1 (or 2) application that is continuously (every 200 ms) asking PC/SC for card status. That is a very bad PC/SC behaviour.
You should try to identify the bogus application and fix it.

> 2) As soon as I plug the USB key, it reaches 100% CPU and top first place but do not show anything diffrent in the log.
>
> will try a strace...

[pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1) = 1 ([{fd=5, revents=POLLIN}])
[pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1) = 1 ([{fd=5, revents=POLLIN}])
[pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1) = 1 ([{fd=5, revents=POLLIN}])
[pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1) = 1 ([{fd=5, revents=POLLIN}])
[pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource temporarily unavailable)

Maybe a problem in libusb.

Do you have kernel errors in dmesg output?

What is the output of "lsusb -v" with the USB key plugged in?

Bye

--
Dr. Ludovic Rousseau

eric2....@orange.com

unread,
Jan 22, 2016, 9:30:04 AM1/22/16
to
On 01/22/2016 03:06 PM, Ludovic Rousseau wrote:
> Le 22/01/2016 13:11, eric2....@orange.com a écrit :
>> On 01/20/2016 03:07 PM, Ludovic Rousseau wrote:
>>>
>>> It does not look like the problem is the Broadcom reader.
>>>
>>> Can you generate a log as documented in
>>> https://pcsclite.alioth.debian.org/pcsclite.html#support ?
>>> Start the log and then connect your problematic mass-storage USB key.
>>>
>>> Thanks
>>>
>>
>> Here is the requested log file. Note that I'm not sure the trace will
>> help:
>> 1) As soon as I launch it, I have continuous traces but process
>> does not even appaers in the top first twenty line,
>
> You have 1 (or 2) application that is continuously (every 200 ms)
> asking PC/SC for card status. That is a very bad PC/SC behaviour.
> You should try to identify the bogus application and fix it.
I guess I have installed a binary blob packages given my a key
manufacturer :-( SACSrv il you kinow wht it is... Will kill it and retry
>
>> 2) As soon as I plug the USB key, it reaches 100% CPU and top
>> first place but do not show anything diffrent in the log.
>>
>> will try a strace...
>
> [pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2,
> -1) = 1 ([{fd=5, revents=POLLIN}])
> [pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource
> temporarily unavailable)
> [pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2,
> -1) = 1 ([{fd=5, revents=POLLIN}])
> [pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource
> temporarily unavailable)
> [pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2,
> -1) = 1 ([{fd=5, revents=POLLIN}])
> [pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource
> temporarily unavailable)
> [pid 18790] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2,
> -1) = 1 ([{fd=5, revents=POLLIN}])
> [pid 18790] recvmsg(11, 0x7ff128ae9dd0, 0) = -1 EAGAIN (Resource
> temporarily unavailable)
>
> Maybe a problem in libusb.
>
> Do you have kernel errors in dmesg output?
No. Nothing unusual except USB storage medium traces.
>
> What is the output of "lsusb -v" with the USB key plugged in?
Attached...
lsusb.txt

Ludovic Rousseau

unread,
Jan 22, 2016, 10:00:03 AM1/22/16
to
Le 22/01/2016 15:18, eric2....@orange.com a écrit :
> On 01/22/2016 03:06 PM, Ludovic Rousseau wrote:
>> Le 22/01/2016 13:11, eric2....@orange.com a écrit :
>>> On 01/20/2016 03:07 PM, Ludovic Rousseau wrote:
>>>>
>>>> It does not look like the problem is the Broadcom reader.
>>>>
>>>> Can you generate a log as documented in https://pcsclite.alioth.debian.org/pcsclite.html#support ?
>>>> Start the log and then connect your problematic mass-storage USB key.
>>>>
>>>> Thanks
>>>>
>>>
>>> Here is the requested log file. Note that I'm not sure the trace will help:
>>> 1) As soon as I launch it, I have continuous traces but process does not even appaers in the top first twenty line,
>>
>> You have 1 (or 2) application that is continuously (every 200 ms) asking PC/SC for card status. That is a very bad PC/SC behaviour.
>> You should try to identify the bogus application and fix it.
> I guess I have installed a binary blob packages given my a key manufacturer :-( SACSrv il you kinow wht it is... Will kill it and retry

You can identify a process using PC/SC using:
$ sudo fuser /usr/lib/x86_64-linux-gnu/libpcsclite.so.1

>> Maybe a problem in libusb.

What version of libusb are you using?

Run pcscd as:
$ sudo LIBUSB_DEBUG=99 /usr/sbin/pcscd -dfa

Ludovic Rousseau

unread,
Jan 22, 2016, 11:20:03 AM1/22/16
to
Le 22/01/2016 16:05, eric2....@orange.com a écrit :
> On 01/22/2016 03:52 PM, Ludovic Rousseau wrote:
>> Le 22/01/2016 15:18, eric2....@orange.com a écrit :
>>> On 01/22/2016 03:06 PM, Ludovic Rousseau wrote:
>>>> Le 22/01/2016 13:11, eric2....@orange.com a écrit :
>>>>> On 01/20/2016 03:07 PM, Ludovic Rousseau wrote:
>>>>>>
>>>>>> It does not look like the problem is the Broadcom reader.
>>>>>>
>>>>>> Can you generate a log as documented in https://pcsclite.alioth.debian.org/pcsclite.html#support ?
>>>>>> Start the log and then connect your problematic mass-storage USB key.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>
>>>>> Here is the requested log file. Note that I'm not sure the trace will help:
>>>>> 1) As soon as I launch it, I have continuous traces but process does not even appaers in the top first twenty line,
>>>>
>>>> You have 1 (or 2) application that is continuously (every 200 ms) asking PC/SC for card status. That is a very bad PC/SC behaviour.
>>>> You should try to identify the bogus application and fix it.
>>> I guess I have installed a binary blob packages given my a key manufacturer :-( SACSrv il you kinow wht it is... Will kill it and retry
>>
>> You can identify a process using PC/SC using:
>> $ sudo fuser /usr/lib/x86_64-linux-gnu/libpcsclite.so.1
> sudo fuser /usr/lib/x86_64-linux-gnu/libpcsclite.so.1
> [sudo] password for ceva6380:
> /usr/lib/x86_64-linux-gnu/libpcsclite.so.1.0.0: 14662m
> 19 r-x-ceva6380:~->ps ax | grep 14662
> 14662 ? Sl 11:53 /usr/bin/iceweasel
> 22156 pts/5 S+ 0:00 grep 14662
>
>
> Quite strange!!!

Not really.
You (or an installation script) has configured a PKCS#11 token in iceveasel.
See https://github.com/OpenSC/OpenSC/wiki/Installing-OpenSC-PKCS%2311-Module-in-Firefox,-Step-by-Step

>>
>>>> Maybe a problem in libusb.
>>
>> What version of libusb are you using?
> dpkg -l libusb*
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name Version Architecture Description
> +++-=================================-=====================-=====================-========================================================================
> ii libusb-0.1-4:amd64 2:0.1.12-28 amd64 userspace USB programming library
> ii libusb-1.0-0:amd64 2:1.0.20-1 amd64 userspace USB programming library
> ii libusb-1.0-0-dev:amd64 2:1.0.20-1 amd64 userspace USB programming library development files
> ii libusb-1.0-doc 2:1.0.20-1 all documentation for userspace USB programming
> ii libusb-dev 2:0.1.12-28 amd64 userspace USB programming library development files
> ii libusbmuxd-dev:amd64 1.0.10-2 amd64 USB multiplexor daemon for iPhone and iPod Touch devices - devel
> ii libusbmuxd-tools 1.0.10-2 amd64 USB multiplexor daemon for iPhone and iPod Touch devices - tools
> ii libusbmuxd4:amd64 1.0.10-2 amd64 USB multiplexor daemon for iPhone and iPod Touch devices - library
> 2 r-x-ceva6380:~->su
>
>>
>> Run pcscd as:
>> $ sudo LIBUSB_DEBUG=99 /usr/sbin/pcscd -dfa
>>
>> Bye
>>
> attached log : no specific usb trace while pcscd is at 100% cpu.

Strange.
I also have the Debian package for libusb (1.0.19 from stable) and I get libusb logs.

Can you downgrade libusb to version 1.0.19 and test again?

bye

--
Dr. Ludovic Rousseau

Alexander Mikhailian

unread,
Jan 24, 2016, 7:40:03 PM1/24/16
to
Package: pcscd
Version: 1.8.15-1
Followup-For: Bug #812087

Dear Maintainer,

I have the same problem with pcscd, and I did not even have to insert a
USB mass storage device, when I plug my notebook into the dock station,
fans go off like mad and pcscd takes on CPU cycles.

-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (900, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages pcscd depends on:
ii init-system-helpers 1.24
ii libacr38u [pcsc-ifd-handler] 1.7.11-1
ii libc6 2.21-6
ii libccid [pcsc-ifd-handler] 1.4.22-1
ii libpcsclite1 1.8.15-1
ii libudev1 228-4
ii lsb-base 9.20160110

pcscd recommends no packages.

Versions of packages pcscd suggests:
pn systemd <none>

Ludovic Rousseau

unread,
Jan 25, 2016, 11:40:05 AM1/25/16
to
Hello Alexander and Eric,

Le 25/01/2016 01:13, Alexander Mikhailian a écrit :
> Package: pcscd
> Version: 1.8.15-1
> Followup-For: Bug #812087
>
> Dear Maintainer,
>
> I have the same problem with pcscd, and I did not even have to insert a
> USB mass storage device, when I plug my notebook into the dock station,
> fans go off like mad and pcscd takes on CPU cycles.

This bug is quiet strange.

Alexander, have you tried to generate libusb debug using:
$ sudo LIBUSB_DEBUG=99 /usr/sbin/pcscd -dfa

You may have to downgrade libusb-1.0-0 to version 1.0.19 from stable.



Another idea is to rebuild pcscd with hotplug debug enabled. No need to install pcscd so you can't break your installation.

1. Get the source code of pcsc-lite, for example from https://alioth.debian.org/frs/?group_id=30105&release_id=2019#pcsclite-_1.8.15-title-content

2. install the build dependencies using:
$ sudo apt-get build-dep pcscd

3. edit the file PCSC/src/hotplug_libudev.c and change the line 66 from
#undef DEBUG_HOTPLUG
to
#define DEBUG_HOTPLUG

4. configure pcsc-lite using "./configure"

5. run pcscd using:
$ sudo ./src/pcscd -dfa

6. try to reproduce the 100% CPU consumption problem

This may generate a lot of logs if the problem is with libudev.
0 new messages