[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[1886] 2008-10-05 Hans Lambermont <address@hidden>
From: |
Robert Millan |
Subject: |
[1886] 2008-10-05 Hans Lambermont <address@hidden> |
Date: |
Sun, 05 Oct 2008 10:51:23 +0000 |
Revision: 1886
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1886
Author: robertmh
Date: 2008-10-05 10:51:23 +0000 (Sun, 05 Oct 2008)
Log Message:
-----------
2008-10-05 Hans Lambermont <address@hidden>
* disk/lvm.c (grub_lvm_scan_device): Allocate buffer space for the
circular metadata worst case scenario. If the metadata is circular
then copy the wrap in place.
* include/grub/lvm.h: Add GRUB_LVM_MDA_HEADER_SIZE, from the LVM2
project lib/format_text/layout.h
Circular metadata bug found and patch debugged by Jan Derk Gerlings.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/disk/lvm.c
trunk/grub2/include/grub/lvm.h
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2008-10-03 18:05:52 UTC (rev 1885)
+++ trunk/grub2/ChangeLog 2008-10-05 10:51:23 UTC (rev 1886)
@@ -1,3 +1,12 @@
+2008-10-05 Hans Lambermont <address@hidden>
+
+ * disk/lvm.c (grub_lvm_scan_device): Allocate buffer space for the
+ circular metadata worst case scenario. If the metadata is circular
+ then copy the wrap in place.
+ * include/grub/lvm.h: Add GRUB_LVM_MDA_HEADER_SIZE, from the LVM2
+ project lib/format_text/layout.h
+ Circular metadata bug found and patch debugged by Jan Derk Gerlings.
+
2008-10-03 Felix Zielcke <address@hidden>
* util/i386/pc/grub-install.in: Source grub-mkconfig_lib instead of
update-grub_lib.
Modified: trunk/grub2/disk/lvm.c
===================================================================
--- trunk/grub2/disk/lvm.c 2008-10-03 18:05:52 UTC (rev 1885)
+++ trunk/grub2/disk/lvm.c 2008-10-05 10:51:23 UTC (rev 1886)
@@ -281,7 +281,8 @@
goto fail;
}
- metadatabuf = grub_malloc (mda_size);
+ /* Allocate buffer space for the circular worst-case scenario. */
+ metadatabuf = grub_malloc (2 * mda_size);
if (! metadatabuf)
goto fail;
@@ -300,6 +301,16 @@
}
rlocn = mdah->raw_locns;
+ if (grub_le_to_cpu64 (rlocn->offset) + grub_le_to_cpu64 (rlocn->size) >
+ grub_le_to_cpu64 (mdah->size))
+ {
+ /* Metadata is circular. Copy the wrap in place. */
+ grub_memcpy (metadatabuf + mda_size,
+ metadatabuf + GRUB_LVM_MDA_HEADER_SIZE,
+ grub_le_to_cpu64 (rlocn->offset) +
+ grub_le_to_cpu64 (rlocn->size) -
+ grub_le_to_cpu64 (mdah->size));
+ }
p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);
while (*q != ' ' && q < metadatabuf + mda_size)
Modified: trunk/grub2/include/grub/lvm.h
===================================================================
--- trunk/grub2/include/grub/lvm.h 2008-10-03 18:05:52 UTC (rev 1885)
+++ trunk/grub2/include/grub/lvm.h 2008-10-05 10:51:23 UTC (rev 1886)
@@ -103,6 +103,7 @@
#define GRUB_LVM_FMTT_MAGIC
"\040\114\126\115\062\040\170\133\065\101\045\162\060\116\052\076"
#define GRUB_LVM_FMTT_VERSION 1
+#define GRUB_LVM_MDA_HEADER_SIZE 512
/* On disk */
struct grub_lvm_raw_locn {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [1886] 2008-10-05 Hans Lambermont <address@hidden>,
Robert Millan <=