From: "Vincent Stehlé" <vincent.stehle@arm.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Tom Rini <trini@konsulko.com>,
u-boot@lists.u-boot-project.org
Subject: Re: [PATCH 1/2] efi_loader: prevent set_variable() to record append_write
Date: Tue, 24 Nov 2026 09:48:15 +0100 [thread overview]
Message-ID: <awVPT3B3aHx4Btsm@debian> (raw)
In-Reply-To: <6e9c726c-ef44-44ec-91c1-267273ca8f4c@gmx.de>
On Sun, Nov 22, 2026 at 12:55:09PM +0100, Heinrich Schuchardt wrote:
Hi Heinrich,
Thanks for reviewing. My comments below; I will send a v2.
Best regards,
Vincent.
> On 11/13/26 16:07, Vincent Stehlé wrote:
> > If SetVariable() records the Attributes bitmask with the
> > EFI_VARIABLE_APPEND_WRITE attribute set, this attribute can be returned
> > later on by GetVariable(), while this is forbidden by the UEFI
> > specification. [1]
> >
> > While the non-TEE SetVariable() already makes sure not to record the
> > attribute when appending to an existing variable, it forgets to do so when
> > appending to a non-existing variable; fix it.
> >
> > Link: https://uefi.org/specs/UEFI/2.11/08_Services_Runtime_Services.html#getvariable [1]
> > Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > Cc: Tom Rini <trini@konsulko.com>
> > ---
> > lib/efi_loader/efi_variable.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> > index 9923936c1b5..8bf2c91f3f9 100644
> > --- a/lib/efi_loader/efi_variable.c
> > +++ b/lib/efi_loader/efi_variable.c
> > @@ -384,7 +384,8 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
> > var->length, old_data, data_size, data,
> > time, &changed);
> > } else {
> > - ret = efi_var_mem_ins(variable_name, vendor, attributes,
> > + ret = efi_var_mem_ins(variable_name, vendor,
> > + attributes & ~EFI_VARIABLE_APPEND_WRITE,
>
> Hello Vincent,
>
> Thank you for detecting this bug.
>
> If the variable does not exists yet (var == NULL) and data is provided
> (data_size > 0), you still end up passing around EFI_VARIABLE_APPEND_WRITE
> in unsolicited ways.
At least we are sure now that the 'APPEND attribute does not re-surface
from GetVariable() in this specific case.
Is your concern that we risk passing the attribute to other internal
functions, such as efi_variable_authenticate() maybe?
> Should we remove the flag from `attributes` directly after setting variable
> `append`?
You are right, this is a better solution overall; I will send a v2.
>
> Best regards
>
> Heinrich
>
> > data_size, data, 0, NULL, time,
> > &changed);
> > }
> >
>
next prev parent reply other threads:[~2026-11-24 8:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 15:07 [PATCH 0/2] efi: fix and verify variables append_write Vincent Stehlé
2026-11-13 15:07 ` [PATCH 1/2] efi_loader: prevent set_variable() to record append_write Vincent Stehlé
2026-11-22 11:55 ` Heinrich Schuchardt
2026-11-24 8:48 ` Vincent Stehlé [this message]
2026-11-24 9:53 ` Vincent Stehlé
2026-11-24 10:10 ` Heinrich Schuchardt
2026-11-24 10:41 ` Vincent Stehlé
2026-11-13 15:07 ` [PATCH 2/2] efi_selftest: verify get_variable() never returns append_write Vincent Stehlé
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=awVPT3B3aHx4Btsm@debian \
--to=vincent.stehle@arm.com \
--cc=ilias.apalodimas@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--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