Bug#519223: grub-probe: hangs when reading a corrupt partition table

John Wright john.wright at hp.com
Wed Mar 11 02:29:46 UTC 2009


Package: grub-common
Version: 1.96+20080724-16
Severity: normal

Hello,

If one of the disks in /boot/grub/device.map has the attached partition
table, grub-probe will get stuck in an infinite loop in the
pc_partition_map_iterate() function (in partmap/pc.c).  I discovered
this while installing to a system with several external SAS disks -- if
I disconnected the SAS enclosure, the install worked; otherwise it would
hang at the grub-install stage.  Several of my disks had the same
corrupt table, but I'm not really sure where it came from.  In any case,
grub-probe should just give up on the corrupt partition table, rather
than getting into an infinite loop.

Steps to reproduce:
  
  1. Copy the partition table to a scratch disk:
     # dd if=corrupt-table.dat of=/dev/sdb

  2. Make sure the scratch disk is in /boot/grub/device.map (or create
     one to use in the next step).

  3. Run grub-probe:
     # grub-probe --device-map=/boot/grub/device.map -t device / -v -v

Expected results:
  
  It quickly finishes, spitting out the device that root is on.

Actual results:

  It gets stuck doing the same thing over and over, something like

    /tmp/grub/grub2-1.96+20080724/kern/disk.c:368: Reading `hd2'...
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 0: flag 0x0, type 0x5, start 0x0, len 0x11177330
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
    /tmp/grub/grub2-1.96+20080724/kern/disk.c:368: Reading `hd2'...
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 0: flag 0x0, type 0x5, start 0x0, len 0x11177330
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 1: flag 0x0, type 0x0, start 0x0, len 0x0
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 2: flag 0x0, type 0x0, start 0x0, len 0x0
    /tmp/grub/grub2-1.96+20080724/partmap/pc.c:143: partition 3: flag 0x0, type 0x0, start 0x0, len 0x0
     [ ... ]

-- 
John Wright <john.wright at hp.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: corrupt-table.dat
Type: application/octet-stream
Size: 512 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20090310/09a927dc/attachment.obj 


More information about the Pkg-grub-devel mailing list