From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW75K-0001rk-4x for qemu-devel@nongnu.org; Tue, 15 Oct 2013 12:03:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VW75C-0000D6-SR for qemu-devel@nongnu.org; Tue, 15 Oct 2013 12:03:02 -0400 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:49439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW75C-0000Co-M1 for qemu-devel@nongnu.org; Tue, 15 Oct 2013 12:02:54 -0400 Message-ID: <525D6726.8080703@weilnetz.de> Date: Tue, 15 Oct 2013 18:02:46 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1381503951-27985-1-git-send-email-kwolf@redhat.com> <1381503951-27985-55-git-send-email-kwolf@redhat.com> <525D6516.3010005@weilnetz.de> <20131015155917.GG3039@dhcp-200-207.str.redhat.com> In-Reply-To: <20131015155917.GG3039@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 54/61] blockdev: Remove IF_* check for read-only blockdev_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, Anthony Liguori Am 15.10.2013 17:59, schrieb Kevin Wolf: > Am 15.10.2013 um 17:53 hat Stefan Weil geschrieben: >> Am 11.10.2013 17:05, schrieb Kevin Wolf: >>> IF_NONE allows read-only, which makes forbidding it in this place >>> for other types pretty much pointless. >>> >>> Instead, make sure that all devices for which the check would have >>> errored out check in their init function that they don't get a read-only >>> BlockDriverState. This catches even cases where IF_NONE and -device is >>> used. >>> >>> Signed-off-by: Kevin Wolf >>> Reviewed-by: Eric Blake >>> --- >>> >> This patch breaks current QEMU (SIGSEGV with ARM in several test scenarios): >> >> $ git bisect bad >> 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf is the first bad commit >> commit 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf >> Author: Kevin Wolf >> Date: Fri Sep 13 15:51:47 2013 +0200 >> >> blockdev: Remove IF_* check for read-only blockdev_init >> [...] >> >> See the gdb protocol below for more details (Linux x86_64 host, default >> configuration). >> >> I got a bug report from a Windows user, but the crash is not OS specific. > Does this fix the segfault? > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index 7380f06..4502ad1 100644 > --- a/hw/sd/sd.c > +++ b/hw/sd/sd.c > @@ -494,7 +494,7 @@ SDState *sd_init(BlockDriverState *bs, bool is_spi) > { > SDState *sd; > > - if (bdrv_is_read_only(bs)) { > + if (bs && bdrv_is_read_only(bs)) { > fprintf(stderr, "sd_init: Cannot use read-only drive\n"); > return NULL; > } Yes.