severity 500482 serious tags 500482 - unreproducible moreinfo tags 500482 + patch thanks
Hi, Setting severity to serious (not grave) as this does not affect everyone, but if it does prevents installing kernels. But of course adjust if you disagree. On Sun, 2008-10-26 at 12:17:28 -0700, Steve Langasek wrote: > I have tried to reproduce this with the following (comparable, but not > identical) configuration: > > - install lenny using the daily d-i images > - configure hda1, hdb1 as a 5GB RAID1 /dev/md0, add an ext3 filesystem on > top of it > - create 1GB swap on hda2, hdb2 > - create a 17GB RAID1 /dev/md1 on hda3 and hdb3 > - create a 17GB RAID1 /dev/md2 on hda4 and hdb4 > - create a RAID0 /dev/md3 over /dev/md1 and /dev/md2 with 16KiB chunk size > - pvcreate /dev/md3 > - add /dev/md3 to a VG > - create a LV on the VG > - run grub-probe -d /dev/md0 > - result: 'ext2' is printed; no segfault. > > If you're still able to reproduce this problem, please respond to Felix's > requests for more information, because as far as I can see this bug is > unreproducible in lenny. One of the internal boxes at Nokia had this same problem, it does not have any software RAID nor any LVM setup, but on /dev/sda3 there seems to be remains of what used to be a LV. > If you can reproduce the bug, then please run grub-probe under gdb and > provide a backtrace. Ok even better, just cooked a patch. The problem was that the error recovery code is buggy, and it inserts data structures and does not take them out in case of error unwinding, which happens in this case. I opted to delay the insertion until a point were the code cannot fail. I also check for an additional possible returned NULL. Attached the patch. regards, guillem
>From 2dadbad0d524233b8513f109d57b3e4337eef063 Mon Sep 17 00:00:00 2001 From: Guillem Jover <[EMAIL PROTECTED]> Date: Mon, 27 Oct 2008 23:22:06 +0200 Subject: [PATCH] lvm: Fix error recovery by only adding objects when we cannot fail The error unwinding code was keeping objects referenced in the lists even when those were being unfreed. Delay the addition of those objects to the lists until the code is not going to be able to fail, so that that part does not need to be unwound. --- disk/lvm.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/disk/lvm.c b/disk/lvm.c index cd9e447..51d4a25 100644 --- a/disk/lvm.c +++ b/disk/lvm.c @@ -345,8 +345,6 @@ grub_lvm_scan_device (const char *name) vg->lvs = NULL; vg->pvs = NULL; - vg->next = vg_list; - vg_list = vg; p = grub_strstr (p, "physical_volumes {"); if (p) @@ -383,12 +381,15 @@ grub_lvm_scan_device (const char *name) pv->start = grub_lvm_getvalue (&p, "pe_start = "); if (p == NULL) goto pvs_fail; + + p = grub_strchr (p, '}') + 1; + if (p == NULL) + goto pvs_fail; + pv->disk = NULL; pv->next = vg->pvs; vg->pvs = pv; - p = grub_strchr (p, '}') + 1; - continue; pvs_fail: grub_free (pv->name); @@ -516,16 +517,16 @@ grub_lvm_scan_device (const char *name) goto fail4; } - lv->number = lv_count++; - lv->vg = vg; - lv->next = vg->lvs; - vg->lvs = lv; - p = grub_strchr (p, '}'); if (p == NULL) goto lvs_fail; p += 3; + lv->number = lv_count++; + lv->vg = vg; + lv->next = vg->lvs; + vg->lvs = lv; + continue; lvs_fail: grub_free (lv->name); @@ -533,6 +534,9 @@ grub_lvm_scan_device (const char *name) goto fail4; } } + + vg->next = vg_list; + vg_list = vg; } else { -- 1.6.0.2