bug-grub
[Top][All Lists]
Advanced

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

[bug #43443] GRUB fails to handle 'absent' (zero) indirect block inode t


From: Peter Nelson
Subject: [bug #43443] GRUB fails to handle 'absent' (zero) indirect block inode table entries on ext2 volumes
Date: Sun, 19 Oct 2014 23:59:50 +0000
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?43443>

                 Summary: GRUB fails to handle 'absent' (zero) indirect block
inode table entries on ext2 volumes
                 Project: GNU GRUB
            Submitted by: peterdn
            Submitted on: Sun 19 Oct 2014 23:59:48 GMT
                Category: Filesystem
                Severity: Major
                Priority: 5 - Normal
              Item Group: Software Error
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 
                 Release: Git master
         Reproducibility: Every Time
         Planned Release: None

    _______________________________________________________

Details:

Linux (or at least Ubuntu 14.04) appears to set an indirect block ID (in an
ext2 file's inode table) to 0 to indicate that *all* child blocks are
zero-filled if there's a large gap in that file. If GRUB is asked to read such
a file via a {multiboot|module|cat|testload|...} command, it fails with
"error: attempt to read or write outside of disk `hd0'". This is because GRUB
attempts to follow the the `0' entry and ends up reading garbage in the block
it thinks is the sub-table.

----

Steps to reproduce:

1) Create and/or otherwise mount a disposable ext2 formatted disk(-image):

dd if=/dev/zero of=test.img bs=512 count=131072
mkfs.ext2 -F test.img
sudo losetup /dev/loop0 test.img
sudo mount -t ext2 /dev/loop0 /media/usb


2) Install GRUB on the disk

sudo grub-install --root-directory=/media/usb --no-floppy --force /dev/loop0


3) Create a file with a large zero-filled gap (just enough to ensure every
block under the entire first-indirect entry is zero-filled):

dd if=/dev/zero of=/media/usb/test bs=512 seek=1025 count=1


4) Verify that the only blocks associated with this inode are the root
doubly-indirect block, its child single-indirect block and grandchild direct
block:

debugfs -R "stat test" test.img
> BLOCKS:
> (DIND):530, (IND):531, (512):11777


5) Boot from test.img in bochs or otherwise; at GRUB command prompt try to
load the file:

testload /test
> error: attempt to read or write outside of disk `hd0'.


----

I've attached a patch that simply checks whether a block ID is 0 before
attempting to follow the indirection chain. It appears to fix this issue in my
case.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 19 Oct 2014 23:59:48 GMT  Name: ext2_absent_block.patch  Size: 521B 
 By: peterdn
Patch for issue
<http://savannah.gnu.org/bugs/download.php?file_id=32302>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43443>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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