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 1366611 - Core dumped when do secret-get-value
Summary: Core dumped when do secret-get-value
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-12 12:45 UTC by Yanqiu Zhang
Modified: 2016-11-03 18:52 UTC (History)
11 users (show)

Fixed In Version: libvirt-2.0.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:52:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
gdb.txt for gdb backtrace (3.94 KB, text/plain)
2016-08-12 12:45 UTC, Yanqiu Zhang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Yanqiu Zhang 2016-08-12 12:45:44 UTC
Created attachment 1190378 [details]
gdb.txt for gdb backtrace

Description of problem:
Core dumped when do secret-get-value

Version-Release number of selected component (if applicable):
libvirt-2.0.0-5.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a secret xml:
# cat secret.xml
<secret ephemeral='no' private='yes'>
<description>LUKS passphrase for the main hard drive of our mail
server</description>
<usage type='volume'>
<volume>/var/lib/libvirt/images/testvm.img</volume>
</usage>
</secret>

2.Define the secret
#  virsh secret-define secret.xml
Secret 84fe59dd-6a87-415a-8dc1-1a10a63eeb6e created

3.Do secret-get-value
# virsh secret-get-value 84fe59dd-6a87-415a-8dc1-1a10a63eeb6e
Segmentation fault (core dumped)


Actual results:
As Step 3 descripted.


Expected results:
Should not core dumped and should give an error for no value has been set.


Additional info:
1.It works well on rhel7.2 with libvirt-1.2.17-13.el7.x86_64:
# virsh secret-get-value 8e730bc8-4dc3-43f2-be52-4246716dc6f3
error: Secret not found: secret '8e730bc8-4dc3-43f2-be52-4246716dc6f3' does not have a value

2.# cat /var/log/libvirt/libvirt.log|grep error
2016-08-12 11:36:30.498+0000: 17740: error : secretGetValue:363 : Invalid secret: secret is private
2016-08-12 11:36:30.602+0000: 17739: error : virNetSocketReadWire:1623 : End of file while reading data: Input/output error

3.gdb backtrace: 
Pls refer to attachment: gdb.txt

Comment 2 John Ferlan 2016-08-15 12:11:36 UTC
posted a patch upstream :

http://www.redhat.com/archives/libvir-list/2016-August/msg00749.html

and pushed as:

commit 18701e9d6213be5a622d7c797f3a899b689e26b2
Author: John Ferlan <jferlan>
Date:   Mon Aug 15 07:53:45 2016 -0400

    virsh: Fix core for cmdSecretGetValue
    
...
    
    When commit id 'cb2e3e50' reworked the cmdSecretGetValue call to use
    VIR_DISPOSE_STRING for base64, it neglected to initialize the base64
    value to NULL since the cleanup: label could be reached prior to the
    base64 value being set or not.  This resulted in a core dump, adding
    the initialization will avoid the issue.


git describe 18701e9d6213be5a622d7c797f3a899b689e26b2
v2.1.0-129-g18701e9

Comment 3 John Ferlan 2016-08-15 14:13:51 UTC
POSTed to rhvirt-patches:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2016-August/msg00844.html

Comment 5 yisun 2016-08-26 02:26:41 UTC
Verified on libvirt-2.0.0-6.el7.x86_64 and PASSED


steps:
# virsh secret-list
 UUID                                  Usage
--------------------------------------------------------------------------------
 3c3d6381-f65a-463f-b394-6ea93766262d  volume /var/lib/libvirt/images/121.qcow2
 4ff78f8c-6ee6-4a8d-b638-2b59d5d49279  volume /var/lib/libvirt/images/luks/luks_1.img

# virsh secret-dumpxml 4ff78f8c-6ee6-4a8d-b638-2b59d5d49279
<secret ephemeral='no' private='yes'>
  <uuid>4ff78f8c-6ee6-4a8d-b638-2b59d5d49279</uuid>
  <description>LUKS Sample Secret</description>
  <usage type='volume'>
    <volume>/var/lib/libvirt/images/luks/luks_1.img</volume>
  </usage>
</secret>


# virsh secret-dumpxml 3c3d6381-f65a-463f-b394-6ea93766262d
<secret ephemeral='no' private='no'>
  <uuid>3c3d6381-f65a-463f-b394-6ea93766262d</uuid>
  <usage type='volume'>
    <volume>/var/lib/libvirt/images/121.qcow2</volume>
  </usage>
</secret>


# virsh secret-get-value 3c3d6381-f65a-463f-b394-6ea93766262d
K1JsXDpxIF5EaiEnW1ZnIw==


# virsh secret-get-value 4ff78f8c-6ee6-4a8d-b638-2b59d5d49279
error: Invalid secret: secret is private

Comment 7 errata-xmlrpc 2016-11-03 18:52:32 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/RHSA-2016-2577.html


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