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 1243731 - smart card emulation doesn't work with USB3 (nec-xhci) controller
Summary: smart card emulation doesn't work with USB3 (nec-xhci) controller
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: 7.2
Assignee: Gerd Hoffmann
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1211970
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-16 07:39 UTC by Gerd Hoffmann
Modified: 2015-11-19 05:11 UTC (History)
15 users (show)

Fixed In Version: qemu-kvm-1.5.3-99.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1211970
Environment:
Last Closed: 2015-11-19 05:11:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2213 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2015-11-19 08:16:10 UTC

Description Gerd Hoffmann 2015-07-16 07:39:01 UTC
+++ This bug was initially created as a clone of Bug #1211970 +++

Description of problem:
smart card emulation doesn't work with USB3 (nec-xhci) controller

Version-Release number of selected component (if applicable):
qemu-kvm-1.5.3-86.el7_1.1.x86_64

How reproducible:
always

Steps to Reproduce:
1. set up a VM with smartcard controller and USB3 controller:
    <controller type='usb' index='0' model='nec-xhci'/>
    <smartcard mode='passthrough' type='spicevmc'>
      <address type='ccid' controller='0' slot='0'/>
    </smartcard>
2. connect to the VM (virt-viewer $VM_NAME --spice-smartcard)
3.

Actual results:
smartcard emulation doesn't work. Examples of what is printed to qemu log with both QEMU_CCID_PASSTHRU_DEBUG and QEMU_CCID_DEBUG set to 4 is below

Expected results:
smartcard works just as it works with default controller (USB2 or in domain xml, ich9-ehci/ich9-uhci)

Additional info:
examples of qemu log:
-- 8< --
usb-ccid: ccid_handle_bulk_out 65 GetSlotStatus
usb-ccid: ccid_reserve_recv_buf: QUEUE: reserve 10 bytes
usb-ccid: ccid_calc_status: status = 0
usb-ccid: ccid_bulk_in_copy_to_guest: 10/10 req/act to guest (BULK_IN)
usb-ccid: ccid_bulk_in_copy_to_guest: 10/2 req/act to guest (BULK_IN)
usb-ccid: ccid_bulk_in_copy_to_guest: returning short (EREMOTEIO) 2 < 10
-- 8< --
usb-ccid: ccid_handle_bulk_out 65 GetSlotStatus
usb-ccid: ccid_reserve_recv_buf: QUEUE: reserve 10 bytes
usb-ccid: ccid_calc_status: status = 0
usb-ccid: ccid_bulk_in_copy_to_guest: 10/10 req/act to guest (BULK_IN)
usb-ccid: ccid_bulk_in_copy_to_guest: 10/10 req/act to guest (BULK_IN)
usb-ccid: ccid_handle_bulk_out 65 GetSlotStatus
usb-ccid: ccid_reserve_recv_buf: QUEUE: reserve 10 bytes
usb-ccid: ccid_calc_status: status = 0
usb-ccid: ccid_bulk_in_copy_to_guest: 10/10 req/act to guest (BULK_IN)
usb-ccid: ccid_handle_bulk_out 62 IccPowerOn
usb-ccid: ccid_handle_bulk_out: PowerOn: 0
usb-ccid: ccid_write_data_block_atr: atr contains protocol=0
usb-ccid: ccid_reserve_recv_buf: QUEUE: reserve 22 bytes
usb-ccid: ccid_calc_status: status = 0
usb-ccid: ccid_bulk_in_copy_to_guest: 259/22 req/act to guest (BULK_IN)
usb-ccid: ccid_bulk_in_copy_to_guest: returning short (EREMOTEIO) 22 < 259

usb-ccid: ccid_handle_bulk_out 6f XfrBlock
usb-ccid: ccid_on_apdu_from_guest: seq 27, len 14
usb-ccid: usb-ccid: pending answers:usb-ccid: 0:27
usb-ccid: ccid_bulk_in_copy_to_guest: returning short (EREMOTEIO) 0 < 273
usb-ccid: APDU returned to guest 2 (answer seq 27, slot 0)
usb-ccid: usb-ccid: pending answers:usb-ccid:  empty
usb-ccid: ccid_reserve_recv_buf: QUEUE: reserve 12 bytes
usb-ccid: ccid_calc_status: status = 0

--- Additional comment from Gerd Hoffmann on 2015-04-28 10:05:50 CEST ---

http://patchwork.ozlabs.org/patch/465422/

--- Additional comment from Ademar Reis on 2015-07-15 16:19:48 CEST ---

(In reply to Gerd Hoffmann from comment #1)
> http://patchwork.ozlabs.org/patch/465422/

I don't see this patch upstream yet... What's the plan? Should I devel_ack+ this BZ?

--- Additional comment from Gerd Hoffmann on 2015-07-16 08:26:37 CEST ---

upstream commit 4e8cfbe1143d8384387595b500212d7a7f11aeae

--- Additional comment from Gerd Hoffmann on 2015-07-16 09:00:13 CEST ---

backport posted.

Comment 2 Gerd Hoffmann 2015-07-16 08:21:42 UTC
posted.

Comment 3 Miroslav Rezanina 2015-08-06 04:32:21 UTC
Fix included in qemu-kvm-1.5.3-99.el7

Comment 5 Yanhui Ma 2015-08-13 09:29:56 UTC
reproduce the issue:
host info:
3.10.0-302.el7.x86_64
qemu-kvm-1.5.3-86.el7.x86_64

steps:
1.boot up a rhel7.2 guest with smartcard controller and USB3 controller:
-device nec-usb-xhci -chardev spicevmc,name=smartcard,id=ccid -device usb-ccid -device ccid-card-passthru,chardev=ccid
2.in both host and guest
#yum groupinstall "smart card support"
 #yum remove '*openct*'
 #service pcscd start
3.plug in the reader before you run remote-viewer on host.
  remote-viewer --spice-smartcard spice://$IP:7000
4. open Smart Card Manager application in  guest

actual results:
Smart Card Manager application can not find the samrt card in guest.

verify the issue:
host info:
3.10.0-302.el7.x86_64
qemu-kvm-1.5.3-100.el7.x86_64

steps:
the same as above

actual results:
Smart Card Manager application can find the samrt card in guest.

Comment 6 Pei Zhang 2015-08-17 08:56:03 UTC
Verify this issue from libvirt :

verify version:
libvirt-1.2.17-5.el7.x86_64
qemu-kvm-1.5.3-101.el7.x86_64

verify steps:

1.prepare env
both host and guest : 
# yum groupinstall "smart card support"
# service pcscd start 
Redirecting to /bin/systemctl start  pcscd.service

Plug physical smart card to host .
check in host :
Application ---> SystemTools ---> Smart Card Manager

2.define and start guest with following XML configuration.  

#virsh dumpxml r708 

usb3.0 controller:
<controller type='usb' index='0' model='nec-xhci'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>

ccid controller :
<controller type='ccid' index='0'>
      <alias name='ccid0'/>
    </controller>

smart card passthrough :
 <smartcard mode='passthrough' type='spicevmc'>
      <alias name='smartcard0'/>
      <address type='ccid' controller='0' slot='0'/>
    </smartcard>

spice graphic:
  <graphics type='spice' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

2.1 check qemu cli, make sure guest's qemu cli like following  :
-device nec-usb-xhci,id=usb,bus=pci.0,addr=0x6 
-device usb-ccid,id=ccid0 
-chardev spicevmc,id=charsmartcard0,name=smartcard
-device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0

3.start guest to check
#virsh start r708
#virsh domdisplay r708

3.2 using remote-viewer to check, must with "--spice-smartcard"
# remote-viewer --spice-smartcard spice://$host-IP:5901

check in guest :
Application ---> SystemTools ---> Smart Card Manager
smartcard enrolled.

Comment 7 juzhang 2015-08-17 09:02:21 UTC
According to comment5 and commnet6, set this issue as verified.

Comment 9 errata-xmlrpc 2015-11-19 05:11:29 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-2015-2213.html


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