grub-probe can't probe large logical volumes (LVM)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub |
Unknown
|
Unknown
|
|||
grub2 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Precise |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Hi,
I've had a problem when using the `grub-probe` binary to probe large LVM partitions (for example, a 1.5 TB partition).
This problem was discovered/tested in an Ubuntu 12.04.5.
When trying to probe these large LVM partitions, we get erros like:
$ grub-probe -vvv /PATH/TO/MY/LVM
[...]
grub-
[...]
grub-probe: error: unknown filesystem.
This bug seems like this one: https:/
So, a debug the problem and I discovered that the problem occurs due to an inappropriate multiplication in the file grub-core/
lv->size += seg->extent_count * vg->extent_size;
The lv->size var is an unsigned 64-bits integer. However, the next two vars are respectively an unsigned int and an int. As the result of (unsigned int) * (int) is an integer, it's very easy to get a multiplication overflow (in my case, the result of the multiplication was zero -> lv->size = 0, resulting in the "out of disk" error).
So, I'm proposing a patch for this bug (file lvm_big_size.patch, to be applied after all Debian patched):
Index: grub2-1.
===
--- grub2-1.
+++ grub2-1.
-629,7 +629,8 @@
goto lvs_segment_fail;
p += sizeof("type = \"") - 1;
- lv->size += seg->extent_count * vg->extent_size;
+ lv->size += ((grub_uint64_t) seg->extent_count
+ * (grub_uint64_t) vg->extent_size);
if (grub_memcmp (p, "striped\"",
sizeof ("striped\"") - 1) == 0)
I have already tested this patch using the following commands and it worked:
quilt push -a
DEB_
I'm attaching this patch.
description: | updated |
I also proposed a patch for the upstream code here: https:/ /savannah. gnu.org/ bugs/index. php?45562