From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IUVxb-0007mf-04 for qemu-devel@nongnu.org; Sun, 09 Sep 2007 19:12:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IUVxY-0007hq-Tk for qemu-devel@nongnu.org; Sun, 09 Sep 2007 19:12:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUVxY-0007hT-Pb for qemu-devel@nongnu.org; Sun, 09 Sep 2007 19:12:56 -0400 Received: from lll.lgl.lu ([158.64.72.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IUVxY-0005A5-Ej for qemu-devel@nongnu.org; Sun, 09 Sep 2007 19:12:56 -0400 Received: from hitchhiker.hitchhiker.org.lu (ip-83-99-66-73.dyn.luxdsl.pt.lu [83.99.66.73]) by lll.lgl.lu (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id l89NCmH3021776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Sep 2007 01:12:50 +0200 Received: from hitchhiker.hitchhiker.org.lu (localhost [127.0.0.1]) by hitchhiker.hitchhiker.org.lu (8.14.1/8.14.1/Debian-8ubuntu1) with ESMTP id l89NE833003606 for ; Mon, 10 Sep 2007 01:14:10 +0200 Message-ID: <46E47E40.5010109@misc.lka.org.lu> Date: Mon, 10 Sep 2007 01:14:08 +0200 From: "Alain Knaff (qemu)" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] File descriptor "leak" through /etc/qemu-ifup script Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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