Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 921744 Details for
Bug 1123007
libguestfs 'direct' backend should close file descriptors before exec-ing qemu to avoid leaking !O_CLOEXEC fds
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
leaky.pl
leaky.pl (text/plain), 1.57 KB, created by
Richard W.M. Jones
on 2014-07-28 09:57:24 UTC
(
hide
)
Description:
leaky.pl
Filename:
MIME Type:
Creator:
Richard W.M. Jones
Created:
2014-07-28 09:57:24 UTC
Size:
1.57 KB
patch
obsolete
>#!/usr/bin/perl -w ># Test for leaky file descriptors. ># https://bugzilla.redhat.com/show_bug.cgi?id=1123007 ># https://bugzilla.redhat.com/show_bug.cgi?id=1123794 ># https://bugzilla.redhat.com/show_bug.cgi?id=1123797 > >use strict; >use Fcntl qw(F_GETFD F_SETFD FD_CLOEXEC); >use Sys::Guestfs; > >print "Preparing the test, please wait a moment ...\n"; > ># Open a pipe to self. >die "failed to open pipe: $!" unless pipe READH, WRITEH; > ># Perl correctly sets FD_CLOEXEC on both pipe FDs. However for this ># test we need to clear that on the write handle. >my $flags = fcntl WRITEH, F_GETFD, 0; >$flags &= ~FD_CLOEXEC; >die unless fcntl WRITEH, F_SETFD, $flags; > ># Open libguestfs handle and fork qemu. >my $g = Sys::Guestfs->new (); ># Note the libvirt backend already closes file descriptors. Only ># the 'direct' and 'uml' backends suffered from the bug. >$g->set_backend ("direct"); >$g->add_drive_ro ("/dev/null"); >$g->launch (); > ># Now close the write side of the pipe, and expect to get ># a close indication on the read side. ># ># If the bug has not been fixed, then closing the write side ># has no effect (because the write file descriptor was leaked ># into the subprocess), and the read will hang. ># ># If the bug has been fixed then the read will not hang. >close WRITEH; > >print "Reading ...\n"; >print "IF the script hangs here, THEN the bug is NOT fixed.\n"; > >my $s = ""; >my $r = sysread READH, $s, 100; >if ($r == 0) { > print "GOOD: The bug seems to be fixed.\n"; > exit 0 >} >else { > print "Unexpected return value \$r = $r\n"; > print "UNKNOWN: It's not clear if the bug is fixed or not.\n"; > exit 1 >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1123007
: 921744