From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] efi_loader: implementing non-volatile UEFI variables
Date: Tue, 25 Jun 2019 16:59:32 +0900 [thread overview]
Message-ID: <20190625075931.GP6610@linaro.org> (raw)
In-Reply-To: <20190625063330.699D0240064@gemini.denx.de>
On Tue, Jun 25, 2019 at 08:33:30AM +0200, Wolfgang Denk wrote:
> Dear Takahiro,
>
> In message <20190625011039.GO6610@linaro.org> you wrote:
> >
> > > Think about secure boot. It is a bad idea to expose variables in this way.
> >
> > Actually, we are thinking of disabling U-Boot environment (I mean,
> > ENV_IS_NOWHERE) still allowing for UEFI variables for security reason.
>
> OK. I know of systems that have passed security audits with
> U-Boot environment enabled. In those cases it as sufficient to make
> a certain set of variables immutable.
>
> Also, adding the new "volatile" attribute to the environment flags
> as I suggested would allow to fine-tune which variables get stored
> in the persistent nvironment copy at all.
>
> > One of the differences between U-Boot env and UEFI variables
> > is that the former can and should be saved to backing storage
> > only with explicit "saveenv" command, while the latter are
> > expected to be saved immediately.
>
> OK - but this does not conflict in any way with the U-Boot
> environment concept. In the same way we can add a "volatile"
> property to the flags, we can add something like an "autosave"
> property which would cause that aany modification of the variable
> value would automatically run "env save".
>
> Once you think about more generic features of the property flags you
> can implement all kinds of clever/useful/fancy things. For example,
> one could think of a "protected" property, which would require
> password entry to change the value, etc.
>
> Of course you could also flag variables with an "UEFI" attribute and
> add all kinds of wanted behaviour.
>
> > Preserving respective semantics simultaneously would be possible, but
> > it would make the implementation a bit complicated and ugly.
>
> It does not have to be ugly, and I think it is also not so
> complicatred. In any case it seems more attractive to me than
> adding a completly separate, new implementation for variable
> storage.
Really? Take an example:
U-Boot (non-volatile) variable a: value: A
U-Boot (non-volatile) variable b: value: B
UEFI non-volatile variable c: value: C
Then,
1) user changed b's value to B', but didn't want to save it
2) user changed c's value to C'
How should U-Boot behave here?
3)
- hold B as well as B' and marks b as "modified, but not saved"
- search the entire U-Boot environment, create a temporary buffer
of {a=A, b=B, c=C'} and save it to backing storage
If user does "env save" later,
- discard B (and save {a=A, b=B', c=C'})
I said this is ugly and complicated.
> > Instead, I believe that it will be a clever idea that we should have
> > separate contexts for them as I showed in my non-volatile support patch[1].
> >
> > [1] https://lists.denx.de/pipermail/u-boot/2019-June/371601.html
>
> To be honest: I thinkt his is not really a clever approach. it
> would be _much_ easier to add a "volatile" property to the U-Boot
> variable flags. Your patch modifies 12 files, and adds more than
> 600 lines of code. And since you're modifying env/fat.c I have
> the impression that this is not even universally usable - does it
> really work only when storing the environment in a FAT file system?
> Not with ext4? Or any other storage? And it works only for UEFI, but
> "normal" environment variables do not benefit from this?
>
> Note that my suggested extension of the variable flags would be
> completely agnostic of this...
>
> > One of possible improvements here is to refactor the env code and
> > parameterize "contexts" at env_save()/env_load().
>
> Contexts, or flags. But this does not require much refactoring. It
> should be a straighforward extension.
Contexts != flags, I mean, by Context, a separate "env_t" data
with interfaces like env_save(&env_efi)/env_load(&env_efi).
I don't think that it is a "different implementation."
I don't know why you stick to a "single" storage, but if you don't
see the implementation above(3) as ugly, that's fine. I can take it
since it's is doable anyway.
Thanks,
-Takahiro Akashi
> > > >And I agree on that. But even if it was not the case, having four
> > > >different implementations for the same thing is .... sub-optiman.
> > >
> > > We have a lot of things that can be disabled in U-Boot. Why should we
> > > not be able to disable UEFI variables?
> >
> > To be honest, I'm a bit doubtful about practical meaning of
> > disabling UEFI variables for UEFI execution environment.
>
> This was Heinrich's argument, and I admit that I didn't understandit
> either.
>
> > > UEFI variables should be accessible via the UEFI runtime API and not via
> > > some U-Boot specific hack which no other program but U-Boot cares about.
> >
> > Please notice that one of the reasons that prevents UEFI variables
> > from being accessed by OS is a real hardware(device/controller) may be
> > shared between firmware(i.e. UEFI runtime) and OS and mutually exclusive
> > access must be ensured.
>
> Again, this was Heinrich's argument.
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> There are no data that cannot be plotted on a straight line if the
> axis are chosen correctly.
next prev parent reply other threads:[~2019-06-25 7:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 8:06 [U-Boot] efi_loader: implementing non-volatile UEFI variables Heinrich Schuchardt
2019-06-20 8:30 ` Ilias Apalodimas
2019-06-24 10:23 ` Wolfgang Denk
2019-06-24 17:57 ` Heinrich Schuchardt
2019-06-24 18:50 ` Wolfgang Denk
2019-06-24 19:10 ` Heinrich Schuchardt
2019-06-25 1:10 ` AKASHI Takahiro
2019-06-25 4:41 ` Heinrich Schuchardt
2019-06-25 6:33 ` Wolfgang Denk
2019-06-25 7:59 ` AKASHI Takahiro [this message]
2019-06-25 9:11 ` Wolfgang Denk
2019-06-26 5:26 ` AKASHI Takahiro
2019-06-26 9:18 ` Wolfgang Denk
2019-06-25 5:56 ` Wolfgang Denk
2019-06-25 9:11 ` Ilias Apalodimas
2019-06-25 9:27 ` Wolfgang Denk
2019-06-26 7:37 ` Ilias Apalodimas
2019-06-26 9:44 ` Wolfgang Denk
2019-06-27 5:15 ` AKASHI Takahiro
2019-06-27 7:08 ` Ilias Apalodimas
2019-06-28 7:34 ` Wolfgang Denk
2019-06-28 7:26 ` Wolfgang Denk
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=20190625075931.GP6610@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.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 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.