Hi,

This patch fixes a bug in the floppy probing code path

Wolf Lammen

-- 
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++
This is the fifth in a series of patches that removes a bug and some glitches
from GRUB stage 1. This is against grub-0.94 (alpha), my first four patches
applied.

Submitted by Wolf Lammen, ookami1<at>gmx<dot>de

I looked through the complete code of stage 1 and found some oddities.
This patch addresses one: set up the disk buffer pointer correctly.
Impact: Because of another bug, the floppy_probe code path is hardly ever
executed. This patch deals with this path, so expect no change in behaviour
right now. If the code was executed, the BIOS would tranfer a disk sector to
a random memory location, possibly overwriting valuable information.

Details: INT 13, function 2 (load sectors from disk) expects in ES:BX a
pointer to the transfer buffer. But presently, the code loads BX with the
value to be used in ES, and leaves ES completely unset. If you follow the
code pathes backwards, you can see that ES was last set by INT 13, function 8,
pointing to a segment containing the disk drive parameter tables. You
certainly do not want a disk buffer overlap with the BIOS data.

--- stage1.S    2004-02-10 08:56:31.000000000 +0100
+++ stage1.new  2004-02-10 09:01:12.000000000 +0100
@@ -467,7 +467,9 @@
 
 1:
        /* perform read */
-       movw    $STAGE1_BUFFERSEG, %bx
+       pushw   $STAGE1_BUFFERSEG
+       popw    %es
+       xorw    %bx,%bx
        movw    $0x201, %ax
        movb    $0, %ch
        movb    $0, %dh
_______________________________________________
Bug-grub mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-grub

Reply via email to