From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TO8Oc-0005aR-8C for qemu-devel@nongnu.org; Tue, 16 Oct 2012 10:45:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TO8OW-0001qN-Cf for qemu-devel@nongnu.org; Tue, 16 Oct 2012 10:45:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TO8OW-0001qA-2e for qemu-devel@nongnu.org; Tue, 16 Oct 2012 10:45:20 -0400 Date: Tue, 16 Oct 2012 16:42:12 +0200 From: Stefan Hajnoczi Message-ID: <20121016144212.GA19559@stefanha-thinkpad> References: <1350305057-6287-1-git-send-email-stefanha@redhat.com> <1350305057-6287-3-git-send-email-stefanha@redhat.com> <507D32E0.7020006@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <507D32E0.7020006@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 2/3] qemu-img: Detect backing file chain infinite loops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: kashyap.cv@gmail.com, qemu-devel@nongnu.org, =?iso-8859-1?Q?Beno=EEt?= Canet On Tue, Oct 16, 2012 at 12:11:44PM +0200, Kevin Wolf wrote: > Am 15.10.2012 14:44, schrieb Stefan Hajnoczi: > > A malicious or corruption image can contain an infinite loop of backing > > files. The qemu-img info --backing-chain command must not hang when > > such files are encountered. > > > > Signed-off-by: Stefan Hajnoczi > > This seems to do what is intended, but I think rather than fixing the > 'qemu-img info' special case I'd have fixed bdrv_open() to detect the > situation. When bdrv_open() on the chain fails we'll still need to iterate each image (with infinite loop detection) in qemu-img info. This allows qemu-img info to print out details of the chain and where the chain goes wrong. > Do we need to properly communicate what the broken image is with JSON > output? This patch will only produce broken JSON in the failure case. Ah, you're right. We must close the JSON array and add a test case for this :(. Will send v3. Stefan