qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alain Knaff (qemu)" <qemu@misc.lka.org.lu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script
Date: Mon, 10 Sep 2007 01:14:08 +0200	[thread overview]
Message-ID: <46E47E40.5010109@misc.lka.org.lu> (raw)

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

             reply	other threads:[~2007-09-09 23:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-09 23:14 Alain Knaff (qemu) [this message]
2007-09-10  0:59 ` [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script Luke -Jr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46E47E40.5010109@misc.lka.org.lu \
    --to=qemu@misc.lka.org.lu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).