On Mon, 2008-05-12 at 09:14 -0430, Isaac M. Marcos wrote:
> (gdb) print mda_size
> $1 = 192512
>
> not what you though :-(
OK, we have something interesting here. mda_size is 192512 (0x2f000).
rlocn->offset is 92672 (0x16a00). But (q - metadatabuf) is 325120
(0x4f600). So, the initial value of q was within the buffer, but the
value that caused the segfault was outside the buffer.
It means that GRUB could not find any space character in the buffer and
kept scanning until it hit unallocated space. I believe it's not valid
LVM metadata.
> $ sudo pvck /dev/sda6
> Device /dev/sda6 not found (or ignored by filtering).
So, it's not a LVM physical volume.
> /dev/sda6 3397 6561 25422831 fd Linux raid autodetect
It's a RAID partition. I guess RAID partitions have a different layout.
The fix would be to reject RAID partitions in grub_lvm_scan_device().
The only validity check in that function is presence of the LVM label in
the first 4 sectors. Perhaps additional checks are needed.