Bug 814080

Summary: Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Alex Jia <ajia>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, dyasny, dyuan, eblake, mzhan, rwu, veillard
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-14.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:54:39 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 811683    

Description Alex Jia 2012-04-19 08:03:17 UTC
Description of problem:
The function cmdBlockPull() uses uninitialised memory.

Version-Release number of selected component (if applicable):
# rpm -q libvirt-client
libvirt-client-0.9.10-13.el6.x86_64


How reproducible:
always.

Steps to Reproduce:
$ qemu-img create /var/lib/libvirt/images/test 1M

$ cat > /tmp/test.xml <<EOF
<domain type='qemu'>
  <name>test</name>
  <memory>219200</memory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' autoport='yes' listen='0.0.0.0'/>
  </devices>
</domain>
EOF

$ virsh define /tmp/test.xml
$ valgrind -v virsh blockpull test /var/lib/libvirt/images/test --wait

  
Actual results:

==10906== 1 errors in context 1 of 1:
==10906== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
==10906==    at 0x39CF80F5BE: __libc_sigaction (sigaction.c:67)
==10906==    by 0x43016C: cmdBlockPull (virsh.c:7638)
==10906==    by 0x4150D4: vshCommandRun (virsh.c:18574)
==10906==    by 0x425E73: main (virsh.c:20178)
==10906==  Address 0x7fefffae8 is on thread 1's stack

Expected results:
fix uninitialized memory usage.

Additional info:

Comment 1 Alex Jia 2012-04-19 08:04:21 UTC
Patch for upstream:
https://www.redhat.com/archives/libvir-list/2012-April/msg00980.html

Comment 2 Alex Jia 2012-04-20 05:41:19 UTC
In POST:
commit 2aed9a97f86ed2fd868ca3240c07076e116ced7b
Author: Eric Blake <eblake>
Date:   Thu Apr 19 16:51:11 2012 +0800

    virsh: avoid uninitialized memory usage
    
    Detected by valgrind, via Alex Jia.  Caused by imcomplete
    copy-and-paste from vshWatchJob in commit 3b96a892.
    
    * tools/virsh.c (cmdBlockPull): fix uninitialized memory usage.

Comment 4 Eric Blake 2012-04-24 04:14:30 UTC
I marked this separately in bug 782457#c23, since that one had not been verified yet.

*** This bug has been marked as a duplicate of bug 782457 ***

Comment 5 Eric Blake 2012-04-24 04:20:20 UTC
Wrong bug comment; I meant: dup of bug 811683#c11

*** This bug has been marked as a duplicate of bug 811683 ***

Comment 9 Alex Jia 2012-04-24 08:31:54 UTC
The issue has been fixed on rhel6.2 with libvirt-0.9.10-14.el6.x86_64.

BTW, I will meet the following error. it should be a expected result, right?
error: unsupported configuration: block jobs not supported with this QEMU binary

Comment 18 Alex Jia 2012-04-26 15:54:26 UTC
Move the bug to verified status based on Comment 9.

Comment 20 errata-xmlrpc 2012-06-20 06:54:39 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.

http://rhn.redhat.com/errata/RHSA-2012-0748.html