bug-grub
[Top][All Lists]
Advanced

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

Re: fix in stage 1


From: Jeroen Dekkers
Subject: Re: fix in stage 1
Date: Sun, 29 Feb 2004 18:05:26 +0100
User-agent: Mutt/1.5.5.1+cvs20040105i

On Sun, Feb 29, 2004 at 05:18:15PM +0100, Wolf Lammen wrote:
> Hi Jeroen,
> 
> You asked me about an outstanding patch for a bug with respect to the floppy
> probing.
> 
> I posted a paper titled 'stage 1 weak points' to the grub bug list on
> 2004-02-15
> http://mail.gnu.org/archive/html/bug-grub/2004-02/msg00113.html
> where I described, why the floppy probing code is hardly ever called, and in
> what way the program logic fails. My remark to bug #482 includes a short
> hack to bypass one failure.
> 
> Here is a short description:
> Stage 1 has to find out the so called geometry of a disk before it can
> access it. A bit simplified, it has to know the track size of the disk.
> GRUB stage 1 (and GRUB 2 boot.S as well) uses a BIOS INT 0x13, function 8
> call to retrieve this value. 
> Sadly, this call will tell you the capabilities of the drive rather than
> that of the media. It does so by reading out the battery powered CMOS RAM of 
> the
> clock (Remember: a (floppy) drive is registered with the BIOS by entering
> the drive type). Thus, the drive is not probed itself.
> For hard disks this creates no problems, but a floppy drive suffers from the
> slight difference in semantics: Assume a 1.44 MB floppy disk is inserted
> into a 2.88 MB drive, then the call returns a track size of 36 sectors (the
> maximum capability of the drive), instead of the 18 sectors of a 1.44 MB
> formatted floppy disk. The wrong geometry information will lead to read 
> failures for
> all sectors behind the first track.
> If the program flow sorted the floppy disk case out and used the floppy
> probing instead, all would work fine. But the floppy probing is currently 
> invoked
> under strange conditions only: The above BIOS call has to terminate with
> error. In most cases this will happen only, if either the drive does not exist
> at all, or the battery is exhausted. And then floppy probing will be useless
> as well.
> 
> This is why I wrote that the floppy probing code is hardly ever executed,
> and that GRUB still has an unfixed bug.
> 
> Fixing the bug means enabling a code path, that was dead for a long time.
> Both my computers did not complain, yet, the fixing might trigger some 
> unwanted
> effects (think of hidden BIOS bugs on some machines, uncovered by the now
> executed code). So removing the floppy probing and not supporting out-of-date
> drive types any more, is an option as well.
> 
> This is why I did not send in a patch correcting the bug. I prefered
> discussing matters first.

Okay, I wasn't that far yet with reading stuff. When I've some time
again, I'll look into this problem and try to think about a solution.

P.S. Please keep bug-grub CC'd.
-- 
Jeroen Dekkers




reply via email to

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