All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens.net>
To: grub-devel@gnu.org
Subject: Re: [PATCH 2/2] diskfilter: don't make a RAID array with more than 1024 disks
Date: Tue, 23 Aug 2022 01:55:26 +1000	[thread overview]
Message-ID: <877d30uvbl.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <20220821122236.32491-2-dja@axtens.net>

Daniel Axtens <dja@axtens.net> 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 <dja@axtens.net>
> ---
>  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


  reply	other threads:[~2022-08-22 15:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21 12:22 [PATCH 1/2] diskfilter: check calloc() result for NULL Daniel Axtens
2022-08-21 12:22 ` [PATCH 2/2] diskfilter: don't make a RAID array with more than 1024 disks Daniel Axtens
2022-08-22 15:55   ` Daniel Axtens [this message]
2022-10-06 13:44     ` Daniel Kiper
2022-10-06 13:42 ` [PATCH 1/2] diskfilter: check calloc() result for NULL Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877d30uvbl.fsf@dja-thinkpad.axtens.net \
    --to=dja@axtens.net \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.