From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K44ZY-00047K-1p for mharc-grub-devel@gnu.org; Wed, 04 Jun 2008 21:47:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K44ZW-00046r-7o for grub-devel@gnu.org; Wed, 04 Jun 2008 21:47:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K44ZU-00046A-EB for grub-devel@gnu.org; Wed, 04 Jun 2008 21:47:21 -0400 Received: from [199.232.76.173] (port=42126 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K44ZU-000467-6m for grub-devel@gnu.org; Wed, 04 Jun 2008 21:47:20 -0400 Received: from c60.cesmail.net ([216.154.195.49]:59521) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1K44ZT-00087r-PS for grub-devel@gnu.org; Wed, 04 Jun 2008 21:47:19 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 04 Jun 2008 21:47:18 -0400 Received: from [192.168.0.21] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id 3F9BC619058 for ; Wed, 4 Jun 2008 21:47:18 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20080604233536.GA21711@thorin> References: <20080604233536.GA21711@thorin> Content-Type: text/plain Date: Wed, 04 Jun 2008 21:47:17 -0400 Message-Id: <1212630437.26365.18.camel@dv> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 (2.22.1-2.fc9) Content-Transfer-Encoding: 7bit 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 01:47:22 -0000 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. -- Regards, Pavel Roskin