From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 10/16] efi_loader: UEFI variable persistence
Date: Mon, 6 Apr 2020 19:06:35 +0300 [thread overview]
Message-ID: <20200406160635.GA490379@apalos.home> (raw)
In-Reply-To: <d2507626-eb25-78e4-bad0-405f10a0d1a8@gmx.de>
On Fri, Mar 27, 2020 at 11:30:47AM +0100, Heinrich Schuchardt wrote:
> On 3/27/20 9:07 AM, Punit Agrawal wrote:
> > Heinrich Schuchardt <xypron.glpk@gmx.de> writes:
> >
> > > Persist non-volatile UEFI variables in a file on the EFI system partition.
> > >
> > > The file is written:
> > >
> > > * whenever a non-volatile UEFI variable is changed after initialization
> > > of the UEFI sub-system.
> > > * upon ExitBootServices()
> >
> > I might be missing something but how does this cope with the ESP being
> > on a storage medium access to which is owned by the OS at runtime? e.g.,
> > partition on eMMC or SATA drive.
>
> This development does not guard against manipulation by the OS.
>
> Ilias is cureently working on a solution for ATF based devices that will
> provide secure storage for variables.
>
Ok sorry for jumping in late, I was actually coding what Heinrich mentioned and
I do have a rough prototype.
I think it's time we (Linaro) expose the idea we had a while back a bit more.
The problem we identified is that the current EDK2 implementation on Arm uses
SPM (Secure Partition Manager). Although this works quite well, SPM and
SPD(Secure Payload Dispatcher) are mutually exclusive. So running SPM and
variable storage, means no OP-TEE.
What we ended up doing, is run the EDK2 StandAloneMM application,
responsible for *all* the handling of UEFI variables in an isolated OP-TEE
partition.
By doing so we can add variable storage on U-boot as an 'external' library which
also hapopens to be 'firmware agnostic'.
The only thing U-Boot has to do is route the Get/Set variable to the Secure World
and if there's an OP-TEE instance running the variables will be handled by that.
This includes authentication and writing them to a medium. The medium can either
be a dedicated flash on Secure world, an RPMB partiiton of the eMMC or a
file in some filesystem.
Storing them on a dedicated Secure world flash, means that the vendor has to
provide that driver in EDK2.
Storing them on an eMMC has a single requirement. An eMMC driver in U-boot, since
OP-TEE uses an existing U-Boot supplicant to access the RPMB.
Storing them on a filesystem through OP-TEE is not implemented by us yet but it
might worth a try since at least the variable verification and authentication
will be executed in Secure World.
In any case this renders U-Boot agnostic to the actual variables, again, as long
it routes the requests to the secure world.
That being said I do believe Heinrich's patch is very useful, since if U-Boot
doesn't run on an Arm core, you still have a way of providing some kind of
secure storage (and a fallback for Arm devices without options (1), (2)).
So, imho, the things need we need to discuss further is:
- EDK2 uses a firmware block protocol, with it's own defined hears and a
Fault Tolerant Write backup partitions. By using the solution I mentioned, you
inherit that as well. Should the 'raw' U-boot code follow that example and use
the same format for the file? Or is Heinrich's format adequate?
The obvious advantage is that systsems can switch between EDK2/U-Boot and
still be able to use the same variable format.
The disadvantage is that it's kind of complicated for my taste :)
- Should U-boot try to offer similar code for variable authentation and
verification? The reason we decided to run StandAloneMM and get those from
EDK2, is that the whole variable format, attributes and auth of UEFI variables
is complex and big. Does it make sense to add that on U-Boot keeping in mind
it's something running on Non-secure world?
Regards
/Ilias
> >
> > >
[...]
> > > + if (r || len != actlen)
> > > + ret = EFI_DEVICE_ERROR;
> > > +
> > > +error:
> > > + if (ret != EFI_SUCCESS)
> > > + printf("Failed to persist EFI variables\n");
> > > + free(buf);
> > > + return ret;
> > > +#else
> > > + return EFI_SUCCESS;
> > > +#endif
> > > +}
> > > +
> >
> > [...]
> >
>
next prev parent reply other threads:[~2020-04-06 16:06 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-27 5:27 [PATCH 00/16] efi_loader: non-volatile and runtime variables Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 01/16] cmd: efidebug: fix int to pointer cast Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 02/16] efi_loader: only reserve memory if fdt node enabled Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 03/16] efi_loader: eliminate EFI_CALL() for variable access Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 04/16] part: detect EFI system partition Heinrich Schuchardt
2020-03-27 6:35 ` Punit Agrawal
2020-03-27 7:21 ` Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 05/16] efi_loader: identify " Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 06/16] efi_loader: keep attributes in efi_set_variable_int() Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 07/16] efi_loader: export initialization state Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 08/16] efi_loader: change setup sequence Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 09/16] efi_loader: imply FAT, FAT_WRITE Heinrich Schuchardt
2020-03-31 5:28 ` AKASHI Takahiro
2020-03-31 6:44 ` Heinrich Schuchardt
2020-03-31 7:44 ` AKASHI Takahiro
2020-03-31 8:20 ` Mark Kettenis
2020-04-01 0:31 ` AKASHI Takahiro
2020-04-01 6:43 ` Heinrich Schuchardt
2020-04-01 17:56 ` Mark Kettenis
2020-04-02 1:34 ` AKASHI Takahiro
2020-03-31 13:08 ` Heinrich Schuchardt
2020-03-31 23:57 ` AKASHI Takahiro
2020-04-01 1:14 ` AKASHI Takahiro
2020-04-01 6:31 ` Heinrich Schuchardt
2020-04-01 7:04 ` AKASHI Takahiro
2020-04-02 12:33 ` Ilias Apalodimas
2020-03-27 5:27 ` [PATCH 10/16] efi_loader: UEFI variable persistence Heinrich Schuchardt
2020-03-27 8:07 ` Punit Agrawal
2020-03-27 10:30 ` Heinrich Schuchardt
2020-03-30 10:03 ` Punit Agrawal
2020-04-06 16:06 ` Ilias Apalodimas [this message]
2021-01-02 22:15 ` Peter Robinson
2020-03-27 5:27 ` [PATCH 11/16] efi_loader: export efi_convert_pointer() Heinrich Schuchardt
2020-03-27 5:27 ` [PATCH 12/16] efi_loader: optional pointer for ConvertPointer Heinrich Schuchardt
2020-03-31 5:23 ` AKASHI Takahiro
2020-03-31 6:52 ` Heinrich Schuchardt
2020-03-31 7:51 ` AKASHI Takahiro
2020-03-27 5:27 ` [PATCH 13/16] efi_loader: memory buffer for variables Heinrich Schuchardt
2020-03-27 8:09 ` Punit Agrawal
2020-03-27 10:45 ` Heinrich Schuchardt
2020-03-30 10:50 ` Punit Agrawal
2020-03-27 5:27 ` [PATCH 14/16] efi_loader: use memory based variable storage Heinrich Schuchardt
2020-03-27 19:44 ` [PATCH 00/16] efi_loader: non-volatile and runtime variables Simon Glass
2020-03-28 6:42 ` Heinrich Schuchardt
2020-03-31 6:05 ` [PATCH 15/16] efi_loader: enable UEFI variables at runtime Heinrich Schuchardt
2020-03-31 6:05 ` [PATCH 15/16] efi_selftest: adjust runtime test for variables Heinrich Schuchardt
2020-04-01 1:41 ` [PATCH 15/16] efi_loader: enable UEFI variables at runtime AKASHI Takahiro
2020-04-01 6:26 ` Heinrich Schuchardt
2020-04-01 6:51 ` AKASHI Takahiro
2020-03-31 6:07 ` [PATCH 16/16] efi_selftest: adjust runtime test for variables Heinrich Schuchardt
2020-04-01 1:05 ` AKASHI Takahiro
2020-04-01 6:37 ` Heinrich Schuchardt
2020-04-01 7:27 ` AKASHI Takahiro
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=20200406160635.GA490379@apalos.home \
--to=ilias.apalodimas@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox