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 827234 - potential to deadlock libvirt on EPIPE
Summary: potential to deadlock libvirt on EPIPE
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 828565
TreeView+ depends on / blocked
 
Reported: 2012-05-31 22:54 UTC by Eric Blake
Modified: 2013-02-21 07:15 UTC (History)
10 users (show)

Fixed In Version: libvirt-0.9.13-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 828565 (view as bug list)
Environment:
Last Closed: 2013-02-21 07:15:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Comment 2 Dave Allan 2012-06-01 00:33:14 UTC
Eric, from our email exchange it sounds like this behavior only results in the hang of a process already controlled by a user and cannot be exploited to do anything else.  Can you confirm?

Comment 3 Eric Blake 2012-06-01 15:36:51 UTC
I've convinced myself that the deadlock can only happen if you call virCommandSetInputBuffer with more than PIPE_BUF bytes; the only places in our code base that makes these calls are security_apparmor.c (not relevant to RHEL) and hooks.c (but hooks are only run if you can install a shell hook, which means you can already do any number of other things), and therefore this is not a security bug - while it can be exploited to cause deadlock, such an exploit is not a Denial of Service where an unprivileged user is able to lock out a privileged user.  I'm opening up visibility and posting the patch upstream.

Comment 5 Eric Blake 2012-06-04 21:52:30 UTC
Now upstream:
commit 858c2476d9dccf630ad5b7f4d8e0e61e9295c2b6
Author: Eric Blake <eblake>
Date:   Thu May 31 15:50:07 2012 -0600

    command: avoid deadlock on EPIPE situation
    
    It is possible to deadlock libvirt by having a domain with XML
    longer than PIPE_BUF, and by writing a hook script that closes
    stdin early.  This is because libvirt was keeping a copy of the
    child's stdin read fd open, which means the write fd in the
    parent will never see EPIPE (remember, libvirt should always be
    run with SIGPIPE ignored, so we should never get a SIGPIPE signal).
    Since there is no error, libvirt blocks waiting for a write to
    complete, even though the only reader is also libvirt.  The
    solution is to ensure that only the child can act as a reader
    before the parent does any writes; and then dealing with the
    fallout of dealing with EPIPE.

Comment 7 Alex Jia 2012-07-13 08:16:51 UTC
I can reproduce this issue on 'tag v0.9.10' after applied patch of 'tests/*', and the 'commandtest' will be hung forever due to dealock:

<snip>
TEST: sockettest
      ......................................   38  OK
PASS: sockettest
TEST: commandtest
      ....................
</snip>


And it's okay without deadlock after applied patch of 'src/util/command.c'. So change the bug to VERIFIED status.

Comment 8 errata-xmlrpc 2013-02-21 07:15:58 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-2013-0276.html


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