From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1P0VDR-0000Y4-2K for mharc-grub-devel@gnu.org; Tue, 28 Sep 2010 04:07:09 -0400 Received: from [140.186.70.92] (port=33622 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0VDO-0000Xz-OJ for grub-devel@gnu.org; Tue, 28 Sep 2010 04:07:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0VDN-0001ly-CX for grub-devel@gnu.org; Tue, 28 Sep 2010 04:07:06 -0400 Received: from efeu.mur.at ([89.106.208.66]:46262) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0VDN-0001lm-77 for grub-devel@gnu.org; Tue, 28 Sep 2010 04:07:05 -0400 Received: from localhost (localhost [127.0.0.1]) by efeu.mur.at (Postfix) with ESMTP id 5015822097 for ; Tue, 28 Sep 2010 10:07:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at efeu.mur.at Received: from efeu.mur.at ([127.0.0.1]) by localhost (efeu.mur.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O2w14MkEl0rU for ; Tue, 28 Sep 2010 10:07:02 +0200 (CEST) Received: from [IPv6:2a02:3e0:1:0:213:d4ff:febb:27b] (unknown [IPv6:2a02:3e0:1:0:213:d4ff:febb:27b]) by efeu.mur.at (Postfix) with ESMTPSA for ; Tue, 28 Sep 2010 10:07:02 +0200 (CEST) Resent-From: Martin Schitter Resent-To: grub-devel@gnu.org Resent-Date: Tue, 28 Sep 2010 10:07:03 +0200 Resent-Message-Id: <4CA1A227.3090808@mur.at> Resent-User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100913 Icedove/3.0.7 Message-ID: <4CA0FF76.90207@mur.at> Date: Mon, 27 Sep 2010 22:32:54 +0200 From: Martin Schitter User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100913 Icedove/3.0.7 MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------010405040805050400010800" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 28 Sep 2010 04:07:06 -0400 Subject: [PATCH] segfault in grub-probe when spare or faulty disks are found X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 08:07:08 -0000 This is a multi-part message in MIME format. --------------010405040805050400010800 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit the actual raid implementation doesn't handle spare or faulty drives in a linux software raid array in a sane way. grub-probe will reproducible crash in such a setup. please include the attached trivial patch to fix this problem. for more information see: https://savannah.gnu.org/bugs/?31119 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593652 --------------010405040805050400010800 Content-Type: text/x-patch; name="grub2-raid-better.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grub2-raid-better.diff" === modified file 'grub-core/disk/raid.c' --- grub-core/disk/raid.c 2010-09-13 21:59:22 +0000 +++ grub-core/disk/raid.c 2010-09-25 22:20:29 +0000 @@ -501,7 +501,8 @@ grub_dprintf ("raid", "array->nr_devs > array->total_devs (%d)?!?", array->total_devs); - if (array->device[new_array->index] != NULL) + if ((new_array->index < GRUB_RAID_MAX_DEVICES) && + (array->device[new_array->index] != NULL)) /* We found multiple devices with the same number. Again, this shouldn't happen. */ grub_dprintf ("raid", "Found two disks with the number %d?!?", @@ -609,9 +610,14 @@ } /* Add the device to the array. */ - array->device[new_array->index] = disk; - array->start_sector[new_array->index] = start_sector; - array->nr_devs++; + + /* ignore spare/faulty disks and more then GRUB_RAID_MAX_DEVICES */ + if (new_array->index < GRUB_RAID_MAX_DEVICES) + { + array->device[new_array->index] = disk; + array->start_sector[new_array->index] = start_sector; + array->nr_devs++; + } return 0; } --------------010405040805050400010800--