From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1R10gE-0004sV-7H for mharc-grub-devel@gnu.org; Tue, 06 Sep 2011 14:47:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0tAT-0003A2-1u for grub-devel@gnu.org; Tue, 06 Sep 2011 06:46:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0tAO-000178-Um for grub-devel@gnu.org; Tue, 06 Sep 2011 06:46:13 -0400 Received: from mail.seebyte.com ([80.193.213.29]:33910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0tAO-00016x-Kr for grub-devel@gnu.org; Tue, 06 Sep 2011 06:46:08 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.seebyte.com (Postfix) with ESMTP id 100831986; Tue, 6 Sep 2011 11:46:06 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at mail.seebyte.com Received: from mail.seebyte.com ([127.0.0.1]) by localhost (seebyte2.seebyte.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6IVE6S2rH6Wx; Tue, 6 Sep 2011 11:45:59 +0100 (BST) Received: from sbl-sc-laptop1.seebyte.com (stephane-chazelas-laptop1.seebyte.com [10.10.10.4]) by mail.seebyte.com (Postfix) with ESMTPSA id DC23317B1; Tue, 6 Sep 2011 11:45:59 +0100 (BST) Received: from stephane by sbl-sc-laptop1.seebyte.com with local (Exim 4.76) (envelope-from ) id 1R0tAF-00077X-KZ; Tue, 06 Sep 2011 11:45:59 +0100 Date: Tue, 6 Sep 2011 11:45:59 +0100 From: Stephane Chazelas To: Colin Watson Subject: Re: Bug#632048: segfault in grub-setup Message-ID: References: <20110906081857.GE3355@riva.dynamic.greenend.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110906081857.GE3355@riva.dynamic.greenend.org.uk> User-Agent: Mutt/1.5.16 (2007-09-19) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.193.213.29 X-Mailman-Approved-At: Tue, 06 Sep 2011 14:47:27 -0400 Cc: grub-devel@gnu.org, 632048-forwarded@bugs.debian.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:46:14 -0000 2011-09-06 09:18:57 +0100, Colin Watson: > On Tue, Sep 06, 2011 at 08:39:24AM +0100, Stephane Chazelas wrote: > > I do get a segfault as well when doing a grub-setup/grub-install > > on a mdraid with 1.2 metadata. > > > > The segv is in: > > > > grub_util_biosdisk_is_floppy() because the disk->id for the root > > device is not a bios disk id, but a big number that is the > > "array id". The patch below seems to fix it for me, though I > > can't tell it's the right fix or not (probably not). > > This fix makes sense to me; calling grub_util_biosdisk_is_floppy on > disks that aren't GRUB_DISK_DEVICE_BIOSDISK_ID doesn't make sense. > grub-devel, second opinion? > > > --- a/util/grub-setup.c 2011-09-05 12:11:31.864955442 +0100 > > +++ b/util/grub-setup.c 2011-09-05 13:00:24.891368760 +0100 > > @@ -315,7 +315,7 @@ > > /* If DEST_DRIVE is a hard disk, enable the workaround, which is > > for buggy BIOSes which don't pass boot drive correctly. Instead, > > they pass 0x00 or 0x01 even when booted from 0x80. */ > > - if (!allow_floppy && !grub_util_biosdisk_is_floppy (dest_dev->disk)) > > + if (!allow_floppy && dest_dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID && !grub_util_biosdisk_is_floppy (dest_dev->disk)) > > /* Replace the jmp (2 bytes) with double nop's. */ > > *boot_drive_check = 0x9090; > > } [...] The fact that the problem doesn't occur with mdraid-0.9 makes me think the problem might be somewhere else though (like that dest_dev->disk should be a biosdisk above).. -- Stephane