Ok, I finally got my hardware and was able to test grub2 on a real software RAID. Apparently I found yet another problem with the lvm code. This yields to either complete segfaults with all the grub tools,
or an instant reboot if the lvm module is loaded at boot time.

What is happening exactly.

Setup:

LVM on a RAID-5 software raid with a 1.0 superblock. The 1.0 superblock is crucial here.

Problem:

The lvm module iterates over every disk. It also checks the raw RAID partitions. Now in my case it does find part of the LVM2 header (GRUB_LVM_FMTT_MAGIC,...) see disk/lvmc:286. But apparently this is only part of the information, the rest is scattered over the other RAID disks. So we have the header but the rest of the metadata is garbage. The code does not check for this and SEGFAULTS in line 311 grub_memcpy since p is just FUBAR in this case.

The following patch fixes this for me but as you can see there must be a better way to check for this case.


Index: disk/lvm.c
===================================================================
RCS file: /sources/grub/grub2/disk/lvm.c,v
retrieving revision 1.6
diff -u -r1.6 lvm.c
--- disk/lvm.c  9 Feb 2008 10:49:29 -0000 1.6
+++ disk/lvm.c  2 Mar 2008 08:41:01 -0000
@@ -295,6 +295,10 @@
   rlocn = mdah->raw_locns;
   p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);

+  /* FIXME find a better way to detect broken LVM metadata */
+  if (!grub_strstr(q, "id = \""))
+    goto fail;
+
   while (*q != ' ')
     q++;

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to