From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K4eJY-00014C-Bf for mharc-grub-devel@gnu.org; Fri, 06 Jun 2008 11:57:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K4eJW-00013Z-LL for grub-devel@gnu.org; Fri, 06 Jun 2008 11:57:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K4eJV-00012r-05 for grub-devel@gnu.org; Fri, 06 Jun 2008 11:57:14 -0400 Received: from [199.232.76.173] (port=48680 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4eJU-00012l-J6 for grub-devel@gnu.org; Fri, 06 Jun 2008 11:57:12 -0400 Received: from aybabtu.com ([69.60.117.155]:38925) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K4eJU-0008PR-7U for grub-devel@gnu.org; Fri, 06 Jun 2008 11:57:12 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K4eIE-0005mR-V1 for grub-devel@gnu.org; Fri, 06 Jun 2008 17:55:55 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K4eJ7-0003TO-S0 for grub-devel@gnu.org; Fri, 06 Jun 2008 17:56:50 +0200 Date: Fri, 6 Jun 2008 17:56:49 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080606155649.GA13255@thorin> References: <20080604233536.GA21711@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080604233536.GA21711@thorin> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] biosdisk / open_device() messing up offsets X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2008 15:57:14 -0000 Committed. On Thu, Jun 05, 2008 at 01:35:36AM +0200, Robert Millan wrote: > > It seems that open_device() in biosdisk is messing up offsets when > accessing partitions. For example if you try: > > grub> hexdump (hd0,1) > > in grub-emu, you'll get a message saying lseek failed. The problem is that > it substracts to the sector offset, so all accesses get to wrong data and > accessing sector 0 results in underflow. > > I would think those lines (see patch) are plainly wrong, but they appear to > be very old, and it is strange that this wasn't noticed earlier. Maybe we > have changed behaviour around partition/disk offsets, causing this breakage > without noticing? > > -- > Robert Millan > > I know my rights; I want my phone call! > What good is a phone call… if you are unable to speak? > (as seen on /.) > diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c > --- ../grub2/util/biosdisk.c 2008-06-04 16:00:30.000000000 +0200 > +++ ./util/biosdisk.c 2008-06-05 01:17:00.000000000 +0200 > @@ -298,9 +298,6 @@ open_device (const grub_disk_t disk, gru > > /* Make the buffer cache consistent with the physical disk. */ > ioctl (fd, BLKFLSBUF, 0); > - > - if (is_partition) > - sector -= disk->partition->start; > } > #else /* ! __linux__ */ > fd = open (map[disk->id].device, flags); > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.)