From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oQ9m5-0004Le-C5 for mharc-grub-devel@gnu.org; Mon, 22 Aug 2022 11:55:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9m3-0004GY-Nz for grub-devel@gnu.org; Mon, 22 Aug 2022 11:55:35 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:46846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9m2-0005mT-3o for grub-devel@gnu.org; Mon, 22 Aug 2022 11:55:35 -0400 Received: by mail-pl1-x629.google.com with SMTP id jm11so10287590plb.13 for ; Mon, 22 Aug 2022 08:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :from:to:cc; bh=KQdzHshp29HelrYYvaLvWwMOswtdaz3XWzh2ALeIfZg=; b=GWDwgAgGuWvff7USLQs2ACAOoWViCFaYz6Lw/FSGvKQUgCaIo9jFuGR0BI3SMwamSA HdYZfJOBFxl3XSroF0VxdHZqcHyepGwQOKmSfrjiO76drv+IoIBr8ki53n9/l8FovnRj wNgpNeTR2UaJDzRcs56/qU0csyMBPeDsxnWOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc; bh=KQdzHshp29HelrYYvaLvWwMOswtdaz3XWzh2ALeIfZg=; b=b2zhgl6smuYbZEqE4oQhDNm3i/e1KkwFU2AOML6IR2kSWOvldOyElxtSiknz6iB/+o De8MoA2xQyO9zK1gXYIGXDZn7WiB1Ty5g+lZ6bt0tAQLbFKoF+WN0q36LOhGf7qKfBm1 z3vBpNE+mCrsZJhLhoriiTufOA9vVJqFoU/i1pJgBF0fCs8BSBn3NVvwpTkbzcThpi6B uH0yoi1gtk4/BWSXcvACH8iwyVR/+e34/eL0i9CK+SwDf20kwipaHcKoXBHKLOaTCMWN cezhXj/hy8CnhsmTBmnReKicfe3i9VXkjbXnTAaWqEUqHoWZmiySRqk82xNpdNBjP+FD xXOw== X-Gm-Message-State: ACgBeo2o/Y4uY2Pywbvc54hDST5qXD4vvLwA6xd7mDjIfTTUU8UaVjFF cErTlczlN6yJHMLWTbA+B6GQjlBhGBPkZQ== X-Google-Smtp-Source: AA6agR66X+57Jw5h6qSD6Wp7eh28Hkocr3ooOW3bBzkCiVMQcDcz69wBYBIF/yPTmVV17OU/qSpJzg== X-Received: by 2002:a17:90b:3b46:b0:1fb:5993:f893 with SMTP id ot6-20020a17090b3b4600b001fb5993f893mr587691pjb.229.1661183731700; Mon, 22 Aug 2022 08:55:31 -0700 (PDT) Received: from localhost ([2001:4479:e300:5b00:159b:82e5:ae2c:2c01]) by smtp.gmail.com with ESMTPSA id x64-20020a628643000000b005368192372fsm3213659pfd.200.2022.08.22.08.55.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 08:55:31 -0700 (PDT) From: Daniel Axtens To: grub-devel@gnu.org Subject: Re: [PATCH 2/2] diskfilter: don't make a RAID array with more than 1024 disks In-Reply-To: <20220821122236.32491-2-dja@axtens.net> References: <20220821122236.32491-1-dja@axtens.net> <20220821122236.32491-2-dja@axtens.net> Date: Tue, 23 Aug 2022 01:55:26 +1000 Message-ID: <877d30uvbl.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=dja@axtens.net; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: Mon, 22 Aug 2022 15:55:36 -0000 Daniel Axtens writes: > This is 'belt and braces' with the last fix: we end up trying to use > too much memory in situations like corrupted Linux software raid setups > purporting to usew a huge number of disks. Simply refuse to permit such > configurations. > > 1024 is a bit arbitrary, yes, and I feel a bit like I'm tempting fate > here, but I think 1024 disks in an array (that grub has to read to boot!) > should be enough for anyone. > > Signed-off-by: Daniel Axtens > --- > grub-core/disk/diskfilter.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c > index 4ac50320ef4e..79c5f4db940a 100644 > --- a/grub-core/disk/diskfilter.c > +++ b/grub-core/disk/diskfilter.c > @@ -1046,6 +1046,13 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, > struct grub_diskfilter_pv *pv; > grub_err_t err; > > + /* We choose not to support more than 1024 disks */ > + if (nmemb > 1024) Ergh, nmemb is an int; I will do a v2 that also checks that it's greater than 0 (or 1, given that it's RAID? I will do some tests.) -- d