* [RFC] efi: variable name size limit in efivar_init()
@ 2021-03-17 7:34 Heinrich Schuchardt
2021-03-17 13:32 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2021-03-17 7:34 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: linux-efi
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] efi: variable name size limit in efivar_init()
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
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2021-03-17 13:32 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: linux-efi
(cc Matthew and Peter)
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] efi: variable name size limit in efivar_init()
2021-03-17 13:32 ` Ard Biesheuvel
@ 2021-03-17 15:07 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2021-03-17 15:07 UTC (permalink / raw)
To: Heinrich Schuchardt, Matthew Garrett, Peter Jones; +Cc: linux-efi
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-17 16:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).