1 From f456add5f4171b27a1f8aca98e02c14e123bbd59 Mon Sep 17 00:00:00 2001
2 From: Rogier <rogier777@gmail.com>
3 Date: Mon, 6 May 2024 15:18:45 -0500
4 Subject: disk/lvm: GRUB fails to detect LVM volumes due to an incorrect
7 When handling a regular LVM volume, GRUB can fail with the message:
9 error: disk `lvmid/******-****-****-****-****-****-****/******-****-****-****-****-****-******' not found.
11 If the condition which triggers this exists, grub-probe will report the
12 error mentioned above. Similarly, the GRUB boot code will fail to detect
13 LVM volumes, resulting in a failure to boot off of LVM disks/partitions.
14 The condition can be created on any LVM VG by an LVM configuration change,
15 so any system with /boot on LVM can become unbootable at "any" time (after
16 any LVM configuration change).
18 The problem is caused by an incorrect computation of mda_end in disk/lvm.c,
19 when the metadata area wraps around. Apparently, this can start happening at
20 around 220 metadata changes to the VG.
22 Fixes: 879c4a834 (lvm: Fix two more potential data-dependent alloc overflows)
23 Fixes: https://savannah.gnu.org/bugs/?61620
25 Signed-off-by: Rogier <rogier777@gmail.com>
26 Signed-off-by: Glenn Washburn <development@efficientek.com>
27 Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
28 Tested-By: Michael Chang <mchang@suse.com>
30 grub-core/disk/lvm.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
33 diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
34 index 7942485..0c32c95 100644
35 --- a/grub-core/disk/lvm.c
36 +++ b/grub-core/disk/lvm.c
37 @@ -290,7 +290,7 @@ grub_lvm_detect (grub_disk_t disk,
41 - if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr))
42 + if (grub_add (ptr, (grub_size_t) grub_le_to_cpu64 (rlocn->size), &ptr))
43 goto error_parsing_metadata;
45 mda_end = (char *)ptr;