qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script
@ 2007-09-09 23:14 Alain Knaff (qemu)
  2007-09-10  0:59 ` Luke -Jr
  0 siblings, 1 reply; 2+ messages in thread
From: Alain Knaff (qemu) @ 2007-09-09 23:14 UTC (permalink / raw)
  To: qemu-devel

Qemu does not close its filedescriptors (or setting the FD_CLOEXEC) when 
invoking the /etc/qemu-ifup script.

Hence any background process spawned from there (such as a dhcpd) will 
also inherit the open filedescriptor, preventing the relevant decide 
(/dev/net/tup) to be reused later on:

If for example you chose a fixed network name using the -net ...ifname= 
  option and have an /etc/init.d/dhcp start in your if-up qemu (in order 
to instruct dhcpd to handle the new interface), the newly spawned dhcp 
will inherit the filedescriptor controlling the tun device, a continue 
hogging it even after the qemu is stopped, and is started again.

Workaround:

Putting the following into the script:
exec 3>/dev/null
exec 4>/dev/null
exec 5>/dev/null
exec 6>/dev/null


But a cleaner solution would be if qemu itself was careful not to leak 
those descriptors in the first place.

Thanks,

Alain

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script
  2007-09-09 23:14 [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script Alain Knaff (qemu)
@ 2007-09-10  0:59 ` Luke -Jr
  0 siblings, 0 replies; 2+ messages in thread
From: Luke -Jr @ 2007-09-10  0:59 UTC (permalink / raw)
  To: qemu-devel

On Sunday 09 September 2007, Alain Knaff (qemu) wrote:
> Workaround:
>
> Putting the following into the script:
> exec 3>/dev/null
> exec 4>/dev/null
> exec 5>/dev/null
> exec 6>/dev/null

better yet: for i in {3..6}; do exec $i>&-; done

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-10  0:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-09 23:14 [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script Alain Knaff (qemu)
2007-09-10  0:59 ` Luke -Jr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).