Bug 827234
| Summary: | potential to deadlock libvirt on EPIPE | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Eric Blake <eblake> | |
| Component: | libvirt | Assignee: | Eric Blake <eblake> | |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 6.3 | CC: | ajia, dallan, dyuan, eblake, gsun, jlieskov, mzhan, rwu, whuang, ydu | |
| Target Milestone: | rc | Keywords: | Security | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | libvirt-0.9.13-2.el6 | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 828565 (view as bug list) | Environment: | ||
| Last Closed: | 2013-02-21 07:15:58 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: | 828565 | |||
|
Comment 2
Dave Allan
2012-06-01 00:33:14 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. 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.
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.
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 |