[libvirt] [PATCH 3/9] daemon: Resolve Coverity RESOURCE_LEAK

Eric Blake eblake at redhat.com
Fri Sep 12 03:09:37 UTC 2014


On 09/11/2014 06:05 PM, John Ferlan wrote:
> With eblake's help - adjust the checks for stdinfd/stdoutfd to ensure the
> values are within the range we expect; otherwise the dup2()'s and subsequent
> VIR_CLOSE() calls cause Coverity to believe there's a resource leak.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  daemon/libvirtd.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

ACK.  This means that if anyone tries to do something crazy like
'libvirtd 0<&-' with stdin closed, and the OS doesn't auto-reopen an fd,
then spawning into a daemon will now fail where it previously worked.
But this is a _good_ thing, as it is much easier to reason about
programs that prohibit being started without something open at all three
standard descriptors, and since POSIX states that it is undefined
behavior if you exec a process without open fds.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140911/9d94164e/attachment-0001.sig>


More information about the libvir-list mailing list