Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZ0Tl-00052S-L0 for qemu-devel@nongnu.org; Fri, 29 Aug 2008 05:41:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZ0Tk-00050j-70 for qemu-devel@nongnu.org; Fri, 29 Aug 2008 05:41:16 -0400 Received: from [199.232.76.173] (port=37990 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZ0Tj-00050H-RM for qemu-devel@nongnu.org; Fri, 29 Aug 2008 05:41:15 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:4626) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KZ0Tj-00075Z-4C for qemu-devel@nongnu.org; Fri, 29 Aug 2008 05:41:15 -0400 Received: from mariner.uk.xensource.com ([10.80.2.22]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m7T9fCEp026325 for ; Fri, 29 Aug 2008 02:41:12 -0700 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1KZ0Ta-0000CL-3E for qemu-devel@nongnu.org; Fri, 29 Aug 2008 10:41:06 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18615.50224.233594.405241@mariner.uk.xensource.com> Date: Fri, 29 Aug 2008 10:41:04 +0100 Subject: Re: [Qemu-devel] [PATCH] [ide] Check that asynchronous (DMA) submission succeeds In-Reply-To: <48B70949.5040906@codemonkey.ws> References: <18614.55228.190438.575778@mariner.uk.xensource.com> <48B70949.5040906@codemonkey.ws> From: Ian Jackson 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 Anthony Liguori writes ("Re: [Qemu-devel] [PATCH] [ide] Check that asynchronous (DMA) submission succeeds"): > It's generally dangerous to call callbacks from the code that is issuing > a bdrv_aio_ operation. A malicious guest could potentially force the > emulation into an infinite loop. I'm not sure exactly what you mean but I'm sure that this is not a problem in this case. In my patch ide_dma_submit_check is called from two places: * ide_read_dma_cb, with ide_read_dma_cb as the callback argument * ide_write_dma_cb, with ide_write_dma_cb as the callback argument In both places the only situation where the callback is reentered immediately is if the aio submission failed. So in that case we recursively enter the callback function, and we do so exactly once since we're going to execute the error handling case (ret==-1). Note that the call to ide_dma_submit_check is at the end of ide_{read,write}_dma_cb precisely to avoid any kind of reentrancy problem. There is no possibility of any looping. Effectively, in the error case, we go back to the top of ide_{read,write}_dma_cb and execute the existing error exit. I'm not sure what you mean in terms of a malicious guest. Surely it is not surprising that a malicious guest can consume qemu CPU ? Or do you mean that it can consume qemu CPU indefinitely without needing to do anything itself ? But in any case if the arrangements in my patch are confusing or likely to be broken by someone editing it in the future who doesn't quite understand these matters, then perhaps we could address this with a comment ? Ian.