Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K4Mlg-00069V-6q for mharc-grub-devel@gnu.org; Thu, 05 Jun 2008 17:13:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K4Mle-00067v-Io for grub-devel@gnu.org; Thu, 05 Jun 2008 17:13:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K4Mld-000677-66 for grub-devel@gnu.org; Thu, 05 Jun 2008 17:13:05 -0400 Received: from [199.232.76.173] (port=48264 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4Mld-000674-1V for grub-devel@gnu.org; Thu, 05 Jun 2008 17:13:05 -0400 Received: from aybabtu.com ([69.60.117.155]:50822) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K4Mlc-0004O0-Rk for grub-devel@gnu.org; Thu, 05 Jun 2008 17:13:05 -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 1K4MkX-0004Cz-MZ for grub-devel@gnu.org; Thu, 05 Jun 2008 23:11:58 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K4MlN-0007DM-SR for grub-devel@gnu.org; Thu, 05 Jun 2008 23:12:49 +0200 Date: Thu, 5 Jun 2008 23:12:49 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080605211249.GC13515@thorin> References: <20080604233536.GA21711@thorin> <1212630437.26365.18.camel@dv> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1212630437.26365.18.camel@dv> 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: Thu, 05 Jun 2008 21:13:07 -0000 On Wed, Jun 04, 2008 at 09:47:17PM -0400, Pavel Roskin wrote: > On Thu, 2008-06-05 at 01:35 +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? > > The question whether sector is relative to the partition or to the whole > disk. From what I see in disk/memdisk.c or it disk/i386/pc/biosdisk.c, > the sector is relative to the whole disk. There is no compensation for > partition offsets. That's low-level code that doesn't know about > partitions, and util/biosdisk.c correctly tries to emulate that. > > I guess grub-emu gets it wrong somewhere. grub-emu itself does nothing about this AFAIK, it just relies on util/biosdisk.c to do the right thing. -- 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 /.)