[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] biosdisk / open_device() messing up offsets

From: Robert Millan
Subject: Re: [PATCH] biosdisk / open_device() messing up offsets
Date: Thu, 5 Jun 2008 23:12:49 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

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

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]