linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Matthew Garrett <mjg59@google.com>,
	Peter Jones <pjones@redhat.com>
Cc: linux-efi <linux-efi@vger.kernel.org>
Subject: Re: [RFC] efi: variable name size limit in efivar_init()
Date: Wed, 17 Mar 2021 16:07:51 +0100	[thread overview]
Message-ID: <CAMj1kXHEACdfON72AKimMDvNN8-Yhd-ff+S3egC_9vO7zYzrag@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXHue99LeDYHP4Cg6+-0iJrjkgti2H8=V4NChw5mScDLCA@mail.gmail.com>

On Wed, 17 Mar 2021 at 14:32, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> (cc Matthew and Peter)
>

Now for real... (thanks Heinrich)

> On Wed, 17 Mar 2021 at 08:35, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> >
> > Hello Ard,
> >
> > in efivar_init() I read:
> >
> >          /*
> >           * Per EFI spec, the maximum storage allocated for both
> >           * the variable name and variable data is 1024 bytes.
> >           */
> >
> >          do {
> >                  variable_name_size = 1024;
> >
> > This dates back at least to Linux 2.5.0 of 23-Nov-2001 where in
> > arch/ia64/kernel/efivars.c we have:
> >
> > /*
> >   * The maximum size of VariableName + Data = 1024
> >   * Therefore, it's reasonable to save that much
> >   * space in each part of the structure,
> >   * and we use a page for reading/writing.
> >   */
> >
> > I cannot find this 1024 byte size limit neither in UEFI spec 2.8B nor in
> > EFI spec 1.1.
> >
> > Variable d719b2cb-3d3a-4596-a3bc-dad00e67656f-db has 5080 bytes of data
> > on my laptop.
> >
> > It may not reasonable to use a variable name exceeding 512 UTF-16
> > characters. But shouldn't we handle this case gracefully in efivar_init()?
> >
>
> This predates my involvement in EFI by a long time, so I've cc'ed
> Peter and Matthew, who may be able to shed some light on this.

      reply	other threads:[~2021-03-17 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  7:34 [RFC] efi: variable name size limit in efivar_init() Heinrich Schuchardt
2021-03-17 13:32 ` Ard Biesheuvel
2021-03-17 15:07   ` Ard Biesheuvel [this message]

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=CAMj1kXHEACdfON72AKimMDvNN8-Yhd-ff+S3egC_9vO7zYzrag@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=pjones@redhat.com \
    --cc=xypron.glpk@gmx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).