From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOUCc-0004Xo-0L for qemu-devel@nongnu.org; Wed, 17 Oct 2012 10:02:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOUCS-0000th-Fz for qemu-devel@nongnu.org; Wed, 17 Oct 2012 10:02:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOUCS-0000tZ-6L for qemu-devel@nongnu.org; Wed, 17 Oct 2012 10:02:20 -0400 Message-ID: <507EBA60.9000000@redhat.com> Date: Wed, 17 Oct 2012 16:02:08 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1350411046-2453-1-git-send-email-coreyb@linux.vnet.ibm.com> <507E3103.1020202@redhat.com> In-Reply-To: <507E3103.1020202@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 4/4] qemu-config: Add new -add-fd command line option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: libvir-list@redhat.com, Corey Bryant , qemu-devel@nongnu.org Am 17.10.2012 06:16, schrieb Eric Blake: > I'm still seeing the corner case of: > > qemu-kvm -add-fd fd=3,set=1 -add-fd fd=4,set=2 4<&- > > where the dup(3) will populate fd 4 prior to the point where we get to > process the -add-fd fd=4 command to notice that the user started > qemu-kvm with fd 4 closed, and thus qemu will silently proceed to use > the wrong fd. > > On the other hand, I'm not sure if that corner case is worth worrying > about, or if we just chalk it up to user stupidity (aka libvirt > programmer stupidity) if they did something like that (most likely, > because the management app forgot to clear FD_CLOEXEC before exec()ing > qemu-kvm). If you specify an FD number that isn't actually open when qemu is stared, you can get any FD that qemu opens internally. I think the correct answer to this problem is "then don't do that". > Hmm, this makes me wonder if I can do something crazy like: > > qemu-kvm -add-fd fd=4,set=1 -qmp /dev/fdset/1 > > to open a monitor on the fd I just passed in? I think so. At least on my side it was intended to allow this. > And what if so, what then > happens on that monitor if I request that fdset 1 be removed? The same as with block devices: The fd stays open until the monitor connection is closed. A closed monitor also triggers fd garbage collection, so at this point the original fd would be closed (well, assuming that you had only one monitor). Kevin