Bug 1012196

Summary: libvirtd crashed when edit "backend model='egd' type='unix'" to guest xml file
Product: Red Hat Enterprise Linux 7 Reporter: EricLee <bili>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, ajia, chhu, dyuan, hliu, mzhan, pkrempa, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.1.1-8.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 09:41:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description EricLee 2013-09-26 01:52:57 UTC
Created attachment 803188 [details]
back trace of libvirtd crashed.

Description
libvirtd crashed when edit "backend model='egd' type='unix'" to guest xml file

Version:
libvirt-1.1.1-6.el7.x86_64
qemu-kvm-1.5.3-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
# virsh edit guest
add following xml to guest:
"
    <rng model='virtio'>
      <rate bytes='1234' period='2000'/>
      <backend model='egd' type='unix'>
        <source mode='bind' service='1024'/>
        <source mode='connect' host='10.66.7.179' service='1024'/>
      </backend>
    </rng>
"
save then :
error: End of file while reading data: Input/output error
Failed. Try again? [y,n,f,?]:
error: One or more references were leaked after disconnect from the hypervisor
error: Failed to reconnect to the hypervisor

Actual results:
libvirtd crashed.

Expected results:
libvirtd not crash.

Comment 2 Peter Krempa 2013-09-26 07:29:10 UTC
Fix posted upstream
https://www.redhat.com/archives/libvir-list/2013-September/msg01551.html

Comment 3 Peter Krempa 2013-09-26 11:42:55 UTC
This issue is now fixed upstream:

commit 795527548fea79902ea4ce32747e069944cf3e61
Author: Peter Krempa <pkrempa>
Date:   Thu Sep 26 08:12:39 2013 +0200

    conf: Don't crash on invalid chardev source definition of RNGs and other
    
    Since commit 297c99a5 an invalid source definition XML of a character
    device that is used as backend for RNG devices, smartcards and redirdevs
    causes crash of the daemon when parsing such a definition.
    
    The device types mentioned above are not a part of a regular character
    device but are backends for other types. Thus when parsing such device
    NULL is passed as the argument @chr_def. Later when checking the
    validity of the definition @chr_def was dereferenced when parsing a UNIX
    socket backend with missing path of the socket and crashed the daemon.
    
    Sample offending configuration:
      <devices>
      ...
        <rng model='virtio'>
          <backend model='egd' type='unix'>
            <source mode='bind' service='1024'/>
          </backend>
        </rng>
      </devices>

Comment 6 chhu 2013-10-09 06:37:57 UTC
Reproduced with libvirt-1.1.1-6.el7.x86_64,
Verified with package:
libvirt-1.1.1-8.el7.x86_64

Test steps:
1. # virsh edit guest
add following xml to guest:
    <rng model='virtio'>
      <rate bytes='1234' period='2000'/>
      <backend model='egd' type='unix'>
        <source mode='bind' service='1024'/>
        <source mode='connect' host='10.66.7.179' service='1024'/>
      </backend>
    </rng>

save then:
error: internal error: Missing source path attribute for char device
Failed. Try again? [y,n,f,?]:

2. #virsh edit guest
add following xml to guest:
        <rng model='virtio'>
          <backend model='egd' type='unix'>
            <source mode='bind' service='1024'/>
          </backend>
        </rng>

save then:
error: internal error: Missing source path attribute for char device
Failed. Try again? [y,n,f,?]:

Test results:
no libvirt crash, change the status to VERIFIED

Comment 7 Ludek Smid 2014-06-13 09:41:30 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.