Received: from list by lists.gnu.org with archive (Exim 4.71) id 1R0qsm-0003Gc-St for mharc-grub-devel@gnu.org; Tue, 06 Sep 2011 04:19:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0qsd-0003Fy-Gk for grub-devel@gnu.org; Tue, 06 Sep 2011 04:19:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0qs3-0005Ab-GI for grub-devel@gnu.org; Tue, 06 Sep 2011 04:19:39 -0400 Received: from chiark.greenend.org.uk ([212.13.197.229]:53200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0qs3-0005AR-Ba for grub-devel@gnu.org; Tue, 06 Sep 2011 04:19:03 -0400 Received: from [172.20.153.9] (helo=riva.pelham.vpn.ucam.org) by chiark.greenend.org.uk (Debian Exim 4.69 #1) with esmtp (return-path cjwatson@ubuntu.com) id 1R0qs1-0004KT-D0; Tue, 06 Sep 2011 09:19:01 +0100 Received: from sarantium.wl.pelham.vpn.ucam.org ([2001:470:95d9:0:21c:26ff:fe49:dd4d] helo=sarantium.pelham.vpn.ucam.org) by riva.pelham.vpn.ucam.org with esmtp (Exim 4.72) (envelope-from ) id 1R0qrz-0003KC-Uu; Tue, 06 Sep 2011 09:18:59 +0100 Received: from riva.dynamic.greenend.org.uk (localhost [127.0.0.1]) by sarantium.pelham.vpn.ucam.org (Postfix) with ESMTPS id AB8DE3E430F; Tue, 6 Sep 2011 09:18:58 +0100 (BST) Date: Tue, 6 Sep 2011 09:18:57 +0100 From: Colin Watson To: grub-devel@gnu.org Subject: Re: Bug#632048: segfault in grub-setup Message-ID: <20110906081857.GE3355@riva.dynamic.greenend.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 212.13.197.229 Cc: 632048-forwarded@bugs.debian.org, Stephane Chazelas 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 08:19:47 -0000 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; > } Thanks, -- Colin Watson [cjwatson@ubuntu.com]