RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1286320 - pcscd generates massive CPU load
Summary: pcscd generates massive CPU load
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: coolkey
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Bob Relyea
QA Contact: Asha Akkiangady
URL:
Whiteboard:
: 1348586 (view as bug list)
Depends On:
Blocks: 1352161
TreeView+ depends on / blocked
 
Reported: 2015-11-28 01:20 UTC by mathewm770
Modified: 2019-12-16 05:07 UTC (History)
7 users (show)

Fixed In Version: coolkey-1.1.0-35.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1352161 (view as bug list)
Environment:
Last Closed: 2016-11-04 06:52:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 350441 0 low CLOSED pcsc-lite uses 100% cpu 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1017431 0 unspecified CLOSED pcscd turns mad producing high load 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2016:2465 0 normal SHIPPED_LIVE coolkey bug fix update 2016-11-03 14:06:22 UTC

Internal Links: 1430268

Description mathewm770 2015-11-28 01:20:56 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. insert USB smart card (Yubikey NEO)
2. add smartcard key to a new started SSH agent
3. use this key in an ssh session

Actual results:

* pcscd maxes out a CPU core until killed or stopped via systemctl
* laptop battery remaining drops from 11 hours to 2 hours
* system fan runs at full speed

Expected results:

pcscd should not max out a CPU core

Additional info:

This seems to be a really old bug that has been around since at least 2008 but has never really been fixed.

Some probably related examples:

RHBZ #350441
RHBZ #1017431

Comment 1 mathewm770 2015-11-28 01:33:27 UTC
Sorry, missed a couple of fields.

Description of problem:
pcscd generates massive CPU load when used with USB smart cards

Version-Release number of selected component (if applicable):
pcsc-lite-1.8.8-6.el7.x86_64
pcsc-lite-ccid-1.4.10-10.el7.x86_64
pcsc-lite-libs-1.8.8-6.el7.x86_64

Comment 2 Mike Jones 2015-12-11 18:04:50 UTC
I can produce this issue reliably with a slightly different use-case.
After using the smartcard to access webmail (Firefox), I log out of email, close the browser and then remove the card from the reader. The pcscd process immediately jumps to 170% - 250% in top and stays there.

Putting the smartcard back into the reader causes it to cease immediately.
Then you can make it happen and make it stop by removing and reinserting the card any number of times.

I installed the pcsc-lite debuginfo package and attached gdb while it was in the high CPU state. The problem is in winscard_svc.c around line 363 in the CMD_GET_READERS_STATE case. While the card is removed, there is a hard loop going on here where the RFWaitForReaderInit() and MessageSend() both return very quickly and then the outer while loop iterates again. Nothing in the sequence ever blocks or takes a break, resulting in the high CPU usage.

Comment 5 Radek Duda 2016-06-06 14:05:16 UTC
Related to bug 1343096

Comment 6 John Heidemann 2016-06-22 16:08:14 UTC
This problem seems to also occur on Fedora 24.
I see both pcscd and gnome-settings running at high CPU after a Yubikey NEO is removed.

It looks like ubuntu found it in March:
https://bugs.launchpad.net/ubuntu/+source/pcsc-lite/+bug/1551897

and upstream has a fix (from the Ubuntu bug report):

https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=pcsclite/CCID.git;a=commitdiff_plain;h=3c21f452543983f3625a1965ce234074cbda6865

Comment 7 John Heidemann 2016-06-22 16:35:55 UTC
Not clear the Fedora 24 problem is the same as here.
I opened a fedora ticket as https://bugzilla.redhat.com/show_bug.cgi?id=1349073

Comment 8 Bob Relyea 2016-06-30 22:19:14 UTC
I can simulate this issue with a normal reader by pluging and unpluging the reader with a card inserted.

Start Firefox.
run top
unplug the reader. Not PCSC run to 100% or more of the cpu (depending on the number of cores).

The ubuntu patch is in pcsc-lite-ccid. I've coded a version of that patch, but it doesn't affect RHEL. If there is a second problem we can add that patch to pcsc-lite.

The issue actually appears to be in libcoolkey I've move the component to coolkey to pick up the coolkey fix.

Comment 10 Bob Relyea 2016-07-01 21:12:56 UTC
fixed in coolkey-1.1.0-35.el7

Comment 12 John Heidemann 2016-07-02 22:42:23 UTC
Bob Relyea (or anyone), can you provide a URL to coolkey-1.1.0-35.el7 source in the REHL build system?  (If it's available.)  I would like to see if it addresses bug #1349073.

Also, what specific binary includes libcoolkey?  I don't see either in the ldd list of pcscd or gnome-settings-daemon on either CentOS7 nor on Fedora 24.

Comment 13 Bob Relyea 2016-07-05 19:03:15 UTC
> Bob Relyea (or anyone), can you provide a URL to coolkey-1.1.0-35.el7 source
> in the REHL build system?  (If it's available.)  I would like to see if it
> addresses bug #1349073.

I believe it's still internal until 7.3 is released.


> Also, what specific binary includes libcoolkey?  I don't see either in the ldd
> list of pcscd or gnome-settings-daemon on either CentOS7 nor on Fedora 24.

It won't show up in ldd. It' dlopen'ed as a PKCS #11 module. NSS will open it, so anything that include libnss3.so would potentially use it, but so would certain apps that use openssl (like ssh).

There are several apps that use the WaitForSlotEvent() call, including firefox, thunderbird and esc (the latter, if installed is running as a daemon looking for smart card insertions).

bob

Comment 14 John Heidemann 2016-07-05 23:08:15 UTC
Wrt comment:13: thanks for both comments.  I'll follow-up at bug #1349073.

Comment 15 Roshni 2016-08-03 19:23:09 UTC
Reproduced the issue using coolkey-1.1.0-35.el7

1. Open firefox when reader is inserted
2.  top | grep pcscd
 2797 root      20   0  486256   1840   1300 S   0.3  0.0   0:00.36 pcscd      
 2797 root      20   0  486256   1840   1300 S   0.3  0.0   0:00.37 pcscd      
 2797 root      20   0  481960   1812   1180 S  47.2  0.0   0:01.79 pcscd      
 2797 root      20   0  481960   1812   1180 S 166.4  0.0   0:06.80 pcscd      
 2797 root      20   0  481960   1812   1180 S 164.1  0.0   0:11.74 pcscd      
 2797 root      20   0  481960   1812   1180 S 166.0  0.0   0:16.72 pcscd      
 2797 root      20   0  481960   1812   1180 S 165.4  0.0   0:21.70 pcscd      
 2797 root      20   0  481960   1812   1180 S 164.8  0.0   0:26.66 pcscd      
 2797 root      20   0  481960   1812   1180 S 170.4  0.0   0:31.79 pcscd      
 2797 root      20   0  481960   1812   1180 S 165.8  0.0   0:36.78 pcscd      
 2797 root      20   0  486256   2048   1292 S 108.0  0.0   0:40.02 pcscd      
 2797 root      20   0  486256   2048   1292 S   0.3  0.0   0:40.03 pcscd      
 2797 root      20   0  486256   2048   1292 S   0.3  0.0   0:40.04 pcscd      
 2797 root      20   0  486256   2048   1292 S   0.3  0.0   0:40.05 pcscd

The reader was removed after 0:00:37

Upgraded to:

Name        : coolkey
Version     : 1.1.0
Release     : 35.el7
Architecture: x86_64
Install Date: Wed 03 Aug 2016 03:03:19 PM EDT
Group       : System Environment/Libraries
Size        : 300220
License     : LGPLv2
Signature   : RSA/SHA256, Thu 28 Jul 2016 01:24:44 PM EDT, Key ID 938a80caf21541eb
Source RPM  : coolkey-1.1.0-35.el7.src.rpm
Build Date  : Fri 01 Jul 2016 05:09:30 PM EDT
Build Host  : x86-034.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://directory.fedora.redhat.com/wiki/CoolKey
Summary     : CoolKey PKCS #11 module

Repeated the steps as above
[rpattath@dhcp129-54 ~]$ top | grep pcscd
 2786 root      20   0  486256   3892   1300 S   0.3  0.0   0:00.34 pcscd      
 2786 root      20   0  486256   3892   1300 S   0.3  0.0   0:00.35 pcscd      
 2786 root      20   0  481960   3864   1180 S   0.7  0.0   0:00.37 pcscd      
 2786 root      20   0  481960   3864   1180 S   0.3  0.0   0:00.38 pcscd      
 2786 root      20   0  481960   3864   1180 S   0.3  0.0   0:00.39 pcscd      
 2786 root      20   0  481960   3864   1180 S   0.3  0.0   0:00.40 pcscd      
 2786 root      20   0  486256   4100   1292 S   0.3  0.1   0:00.41 pcscd      
 2786 root      20   0  486256   4100   1292 S   0.7  0.1   0:00.43 pcscd

The reader was removed after 0:00:35

Comment 17 errata-xmlrpc 2016-11-04 06:52:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2465.html

Comment 18 Bob Relyea 2017-03-21 19:03:40 UTC
*** Bug 1348586 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.