From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1q6aBb-0004U2-QI for mharc-grub-devel@gnu.org; Tue, 06 Jun 2023 13:09:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6aBZ-0004TW-Vn for grub-devel@gnu.org; Tue, 06 Jun 2023 13:09:33 -0400 Received: from dibed.net-space.pl ([84.10.22.86]) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:192) (Exim 4.90_1) (envelope-from ) id 1q6aBY-00060Z-6P for grub-devel@gnu.org; Tue, 06 Jun 2023 13:09:33 -0400 Received: from router-fw.i.net-space.pl ([192.168.52.1]:60222 "EHLO tomti.i.net-space.pl") by router-fw-old.i.net-space.pl with ESMTP id S2181823AbjFFRJ2 (ORCPT ); Tue, 6 Jun 2023 19:09:28 +0200 X-Comment: RFC 2476 MSA function at dibed.net-space.pl logged sender identity as: dkiper Date: Tue, 6 Jun 2023 19:09:26 +0200 From: Daniel Kiper To: Julian Andres Klode Cc: The development of GNU GRUB , Kees Cook , Kees Cook Subject: Re: [PATCH] osdep/linux: Fix md array device enumeration Message-ID: <20230606170926.7lawabajepyppt7v@tomti.i.net-space.pl> References: <20230606161020.2337550-1-julian.klode@canonical.com> <20230606161527.wlq4bhz7kg3qabpy@jak-t14-g3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230606161527.wlq4bhz7kg3qabpy@jak-t14-g3> User-Agent: NeoMutt/20170113 (1.7.2) Received-SPF: pass client-ip=84.10.22.86; envelope-from=dkiper@net-space.pl; helo=dibed.net-space.pl X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jun 2023 17:09:34 -0000 On Tue, Jun 06, 2023 at 06:15:27PM +0200, Julian Andres Klode wrote: > On Tue, Jun 06, 2023 at 06:10:21PM +0200, Julian Andres Klode wrote: > > From: Kees Cook > > > > GET_ARRAY_INFO's info.nr_disks does not map to GET_DISK_INFO's > > disk.number, which is an internal kernel index. If an array has had drives > > added, removed, etc, there may be gaps in GET_DISK_INFO's results. But > > since the consumer of devicelist cannot tolerate gaps (it expects to walk > > a NULL-terminated list of device name strings), the devicelist index (j) > > must be tracked separately from the disk.number index (i). But grub > > wants to only examine active (i.e. present and non-failed) disks, so how > > many disks are left to be queried must be also separately tracked > > (remaining). > > > > Fixes: 49de079bbe1c ("... (grub_util_raid_getmembers): Handle "removed" disks") > > Fixes: 2b00217369ac ("... Added support for RAID and LVM") > > Fixes: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1912043 > > Fixes: https://savannah.gnu.org/bugs/index.php?59887 > > Signed-off-by: Kees Cook > > I did not add a cover letter, I just found this patch in a merge request > on Debian's GitLab, and it still applies, but I haven't tested it > further than Kees did, and don't know what the test case is quite > honestly. This patch is in upstream as commit c39f27cd6 (osdep/linux: Fix md array device enumeration). I realized right now that MD_MAX_DISKS defined in commit c39f27cd6 (osdep/linux: Fix md array device enumeration) is not in sync with commit 2a5e3c1f2 (disk/diskfilter: Don't make a RAID array with more than 1024 disks). I think we should sync both numbers down to 1024... Daniel