linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi <linux-efi@vger.kernel.org>
Subject: [RFC] efi: variable name size limit in efivar_init()
Date: Wed, 17 Mar 2021 08:34:56 +0100	[thread overview]
Message-ID: <75d99346-73c1-993c-8bba-08cb3b3271a2@gmx.de> (raw)


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()?

Best regards

Heinrich

             reply	other threads:[~2021-03-17  7:36 UTC|newest]

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

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=75d99346-73c1-993c-8bba-08cb3b3271a2@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.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 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).