All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: Fit images and EFI_LOAD_FILE2_PROTOCOL
Date: Tue, 6 Oct 2020 14:36:23 +0200	[thread overview]
Message-ID: <2cb94bde-7e44-3fe7-dcdc-509b64b6fe4b@gmx.de> (raw)
In-Reply-To: <CAHFG_=VJ5djd8fy7D611HyR8wifu15ZtSKBAFHVC9PnBL8_24Q@mail.gmail.com>

On 06.10.20 14:04, Fran?ois Ozog wrote:
> As always, Ard made a good point, and I feel compelled?to top post and
> restate stuff.
>
> Here is the supporting deck:
> https://docs.google.com/presentation/d/1JK00su6e7vt8lRfwSt2C9EuuzwcBHLyoLRRrdcYfVWY/edit?usp=sharing
> ?
> We have two boot flows under consideration (not saying others are bad,
> just to say they are on focus):
> A.1 typical distro (slide 2): <EFI firmware/ACPI> --> <shim> --> <grub>
> --> Linux; Linux is here defined as the tuple {vmlinuz}, vmlinuz is
> verified through EFI mechanism by either efi firmware or shim,? ACPI
> tables are verified by firmware, initrd is not verified
> A.2 typical embedded (slide 3): <firmware/DT> -> Linux ; Linux is here
> defined as the tuple {vmlinuz, initrd, dtb} that is folded into a FIT
> and are verified via signature, it avoid errors/attacks about mixing
> vmlinuz/initrd/dtb.
>
> We want EBBR "equivalent" flows (Equivalent meaning with the same level
> of security and accepting the weaknesses).
> B.1 typical distro (slide 4): <EFI firmware/DT> --> <shim> --> <grub>
> --> Linux
> B.2 typical embedded (slide 5): <EFI firmware/DT> -> Linux
>
> For B.1 to be equivalent to A.1, we need the DT to be authenticated
> (ACPI is embedded in the firmware in A.1).
> For B2. to be equivalent to A.2, we? need the DT and initrd to be
> authenticated
>
> _____________
> We can first validate this point: let's check whether we want to do this
> (regardless of the implementation details, focusing on the intention).
>
>
>
> On the implementation side, last call we discussed Trusting DT and we
> ended up talking about trusting initrd too (probably because B.2 in the
> back of our minds, without being explicit about this).
>
> After giving some additional thoughts, it sounds like a good approach is
> to "lead by example": let's implement what we think are the "archetype"
> flows for Qemu and maintain it over time. We would make all changes we
> think are good in all relevant projects (tfa, op-tee, u-boot,
> devicetree, linux kernel, qemu...). Being an "archetype" flow does not
> prevent systems to be EBBR compliant, we just have reference flows.
>
> _____________
> We can validate this second point: are we in agreement that leading by
> an end-to-end example on a platform, rather by technology layers
> (trusting DT PoC was in that spirit) ?
>
>
>
> What are the implementation details of B.1 and B.2?
>
> B.1
> To trust DT the proposal is to make its use closer to ACPI: this is a
> platform attribute that is verified by firmware and handed over to OS.
> To achieve that:?
> - we create a platform repo in devicetree.org <http://devicetree.org>,
> add the Qemu-bsa DT (coming from current Linux kernel ), and maintain it
> over time. We shall ensure forward/backward compatibility of relevant
> Linux drivers.
> - the resulting DTB is compiled and integrated by the platform vendor in
> its TF-A FIP at NT_FW_CONFIG section.

When building OpenSBI you can specify a device-tree using environment
variable FW_PAYLOAD_FDT_PATH.

> - at boot time, TF-A verifies DTB, pass it to U-Boot, U-Boot passes that
> DTB to the shim as a config table and boot flow continues; the platform
> DTB can be overridden?by grub (without any verification, that can be
> seen as a weaker than ACPI case); the Linux EFI-STUB uses EFI_LOAD_FILE2
> protocol to get the initrd (unverified). Linux command line dtb= is disabled
>
> B.2
> To trust DT the proposal is to make its use closer to ACPI: this is a
> platform attribute that is verified by firmware and handed over to OS.
> To trust the initrd the proposal is to leverage the same concept as A.2:
> create a tuple with {vmlinuz, initrd, dtb}
> To achieve that:?
> - we create a platform repo in devicetree.org <http://devicetree.org>,
> add the Qemu-bsa DT (coming from current Linux kernel ), and maintain it
> over time. We shall ensure forward/backward compatibility of relevant
> Linux drivers.

QEMU provides its own device-tree to the firmware. Why would we need a
Linux device-tree for QEMU?

The Linux Foundation is unable to ensure that their device-trees are
usable. With a Linux DTB after v5.3 I cannot start my MacchiatoBin with
v5.4-v5.7.

If Linux does not run with the device tree of the same version, how can
we hope for forward/backward compatibility?

Who takes care that other operating systems (e.g. BSD) are not broken by
DTB changes?

> - the resulting DTB is compiled and integrated by the platform vendor in
> its TF-A FIP at NT_FW_CONFIG section.
> - the platform vendor creates a FIT with the desired tuple
> - an EFI application is actually "booting" that FIT verifying both the
> initrd and the replacement DTB
> - at boot time, TF-A verifies DTB, pass it to U-Boot, U-Boot passes that
> DTB to the EFI application as a config table; The EFI application hooks
> the EFI BS (much like the SHIM does) so that EFI_LOAD_FILE2 of initrd
> goes to the FIT (uefi_merge_fs idea in the slide 5); vmlinuz is verified
> launched via UEFI mechanism, Linux EFI stub gets the initrd with
> EFI_LOAD_PROTOCOL2 which happens to be transparently redirected to the
> FIT (so the initrd is validated as in A.2).

The FIT image file format is not needed here. It is sufficient that the
vendor provides a signed binary that supplies the kernel, initrd, fdt
triplet. There is no need to specify how this binary works internally.

Best regards

Heinrich

>
> _____________??
> Identifying the right flow is the third point to decide on. I hope we
> can achieve this result on the October 14th call. If we agree on
> the?first two points,?the mail thread shall be such that we find
> consensus on how to implement the intention, the above description and
> slide 4/5 in the deck being just starting points. We can go in an entire
> direction.
>

  reply	other threads:[~2020-10-06 12:36 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03  8:51 Fit images and EFI_LOAD_FILE2_PROTOCOL Heinrich Schuchardt
2020-10-03 11:14 ` François Ozog
2020-10-03 11:16   ` François Ozog
2020-10-03 13:12     ` Ard Biesheuvel
2020-10-03 16:35       ` Heinrich Schuchardt
2020-10-03 16:59         ` Ard Biesheuvel
2020-10-05  6:33       ` Ilias Apalodimas
2020-10-05 14:12       ` François Ozog
2020-10-05 15:25         ` Daniel Thompson
2020-10-05 17:14           ` François Ozog
2020-10-04 23:41 ` Cristian Ciocaltea
2020-10-05 22:37 ` Grant Likely
2020-10-06  4:35   ` Heinrich Schuchardt
2020-10-06  7:20     ` Ard Biesheuvel
2020-10-06  8:00       ` François Ozog
2020-10-06  8:05         ` Ard Biesheuvel
2020-10-06 10:13           ` François Ozog
2020-10-06 10:23             ` Ard Biesheuvel
2020-10-06  9:58         ` Daniel Thompson
2020-10-06 10:38     ` Grant Likely
2020-10-06 12:04       ` François Ozog
2020-10-06 12:36         ` Heinrich Schuchardt [this message]
2020-10-06 12:43           ` Grant Likely
2020-10-06 12:52             ` Heinrich Schuchardt
2020-10-06 13:02               ` Grant Likely
2020-10-06 14:22                 ` François Ozog
2020-10-06 14:46                   ` Ard Biesheuvel
2020-10-06 15:08                     ` François Ozog
2020-10-06 15:32                       ` François Ozog
2020-10-06 17:50                       ` Ard Biesheuvel
2020-10-06 13:00           ` François Ozog
2020-10-06 12:38         ` Grant Likely
2020-10-06 12:05       ` Heinrich Schuchardt
2020-10-06 12:15         ` François Ozog
2020-10-06 12:41       ` Ilias Apalodimas
2020-10-06 12:46         ` Grant Likely
2020-10-06 13:12           ` Heinrich Schuchardt
2020-10-06 14:09             ` François Ozog

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=2cb94bde-7e44-3fe7-dcdc-509b64b6fe4b@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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.