Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B91C4338F for ; Mon, 2 Aug 2021 18:54:10 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C67A760F9C for ; Mon, 2 Aug 2021 18:54:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C67A760F9C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9774982E1B; Mon, 2 Aug 2021 20:54:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="VukDdKkG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A8EE82E1B; Mon, 2 Aug 2021 20:54:05 +0200 (CEST) Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 42A1082D6F for ; Mon, 2 Aug 2021 20:54:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf2d.google.com with SMTP id dk2so6564884qvb.3 for ; Mon, 02 Aug 2021 11:54:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZgOct0wDCIvVYlPPCzNJ6XD01Xeak7XP45eDJK9lWIk=; b=VukDdKkGKCSTkZ6joER3tn/Fod/U+RDnBc2TkUWWcr1bep4qex1mdq+c8uoeBpdW0R Du/GXl2eBpp7nC+cB1bnoWW/RmBBWvSEyMi5DFZiBw7qbuyMX5x06mBi1Q+IUJWY+Tig Yd4lEzGqkz59KjCIOHsqkpG7JrinaJTJgL5IQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZgOct0wDCIvVYlPPCzNJ6XD01Xeak7XP45eDJK9lWIk=; b=FyGXQmjr7ntHQ7+Ro35A7g7GtIRcxroMC/wmx30YZfWxsipYaClke4jtCtMGokOCRu fQgcoj094bb+imKyLVjX/g6YV9q8wlTMCjTmIRI7cQuWg1xY062nD/fNHYoY2dFXkmOd C2V3cXwEDOuu/5i5+iuJ+koSaxSUmq9fz8KNPGDDLoHG8Z+sEhE/RTvrK5cjmgwitzKA wtmX8NDaPJRaIoSZbrWbK+LX1sk2m2qgDV7xUf2u91uL2f3c1sZ6hIav82sfCouTKoA6 +alsONlZ6lrMQLSijmfR/ZRjw6di4NuTyzeXkGA28FJGDJqxhT82vz5sQvKQaqqqxESh eQuw== X-Gm-Message-State: AOAM5303CIEcMu+GukZEIfzE1WIP8JS1U/yLNPHnDE0JU9pdiLpjxJug rCbdZ82MnkeQRYeEeK5Ikyq1bA== X-Google-Smtp-Source: ABdhPJyh33FqMEdbXMoN3QzfP/stT/VRE+FsaKN9SS3lcYYY8jZKrZNjfyIZPYxL/ZKpI55UczmwHg== X-Received: by 2002:ad4:566c:: with SMTP id bm12mr17903217qvb.58.1627930439049; Mon, 02 Aug 2021 11:53:59 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-a0a3-ef76-0712-405d.res6.spectrum.com. [2603:6081:7b01:cbda:a0a3:ef76:712:405d]) by smtp.gmail.com with ESMTPSA id t124sm1192200qke.16.2021.08.02.11.53.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Aug 2021 11:53:58 -0700 (PDT) Date: Mon, 2 Aug 2021 14:53:56 -0400 From: Tom Rini To: Simon Glass Cc: U-Boot Mailing List Subject: Re: [PATCH v3 0/7] vpl: Introduce a verifying program loader Message-ID: <20210802185356.GB9379@bill-the-cat> References: <20210712021919.3409934-1-sjg@chromium.org> <20210728143507.GK9379@bill-the-cat> <20210728173713.GT9379@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lJXRn/gbbOJRxJPn" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --lJXRn/gbbOJRxJPn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 28, 2021 at 12:37:55PM -0600, Simon Glass wrote: > Hi Tom, >=20 >=20 > On Wed, 28 Jul 2021 at 11:37, Tom Rini wrote: > > > > On Wed, Jul 28, 2021 at 09:33:56AM -0600, Simon Glass wrote: > > > Hi Tom, > > > > > > On Wed, 28 Jul 2021 at 08:35, Tom Rini wrote: > > > > > > > > On Tue, Jul 27, 2021 at 10:20:49AM -0600, Simon Glass wrote: > > > > > Hi Tom, > > > > > > > > > > On Sun, 11 Jul 2021 at 20:19, Simon Glass wrot= e: > > > > > > > > > > > > U-Boot provides a verified-boot feature based around FIT, but t= here is > > > > > > no standard way of implementing it for a board. At present the = various > > > > > > required pieces must be built up separately, to produce a worki= ng > > > > > > implementation. In particular, there is no built-in support for= selecting > > > > > > A/B boot or recovery mode. > > > > > > > > > > > > This series introduces VPL, a verified program loader. Its purp= ose is to > > > > > > run the verified-boot process and decide which SPL binary shoul= d be run. > > > > > > Adding VPL into the boot flow provides a standard way of implem= enting > > > > > > verified boot. So far, only the phase itself is added along wit= h some > > > > > > Kconfig options. The next step is to create a build for sandbox. > > > > > > > > > > > > Changes in v3: > > > > > > - Move VPL Kconfig options to a separate patch > > > > > > - Add full build support for VPL > > > > > > > > > > > > Changes in v2: > > > > > > - Add some more VPL Kconfig options > > > > > > > > > > > > Simon Glass (7): > > > > > > doc: Convert SPL documentation to ReST > > > > > > doc: Expand SPL docs to explain the phase and config > > > > > > test: Tidy up test building with SPL > > > > > > spl: Move TPL_HASH_SUPPORT down next to other TPL options > > > > > > binman: Add VPL support > > > > > > Introduce Verifying Program Loader (VPL) > > > > > > vpl: Add Kconfig options for VPL > > > > > > > > > > Any thoughts on this one? I have a few updates so can send a reba= se v4 > > > > > if that helps. > > > > > > > > Perhaps some of these general questions would be answered with seei= ng an > > > > implementation for not just sandbox, but real hardware too. But I'm > > > > missing what this provides exactly that we can't do already, or that > > > > would justify a whole new stage rather than just some updates within > > > > existing logic. What is this doing over SPL_FIT_SIGNATURE for exam= ple? > > > > Checking in with a TPM to confirm good measurements? Having written > > > > that out, now I really do want to see this implemented on real hard= ware > > > > much more so than sandbox. > > > > > > Yes it was actually implemented on coral, an x86 Chromebook which is > > > in-tree. I have various patches to come but the docs are at [1] > > > > > > The core reason for it is that SPL sets up SDRAM (and perhaps other > > > things) so needs to be updateable, so we cannot boot the vboot logic > > > in SPL. TPL often has very small size limits so it is difficult to put > > > it in there. I am thinking that VPL can be an optional phase used only > > > if verified boot is enabled. That makes it easy since it has a defined > > > purpose which can be enabled/disabled. > > > > > > BTW in doing this I wonder whether we should look again at the > > > SPL_TPL_ Makefile variables. Do you think PHASE might be better? > > > > > > Regards, > > > Simon > > > > > > [1] https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/doc/cros_c= oral.rst > > > > There's always a "no updates before HERE" line to draw, as you need a > > fall-back option. Since you mention SDRAM, does that mean both TPL and > > VPL are running in SRAM/similar space? If so, why isn't this just part > > of TPL, for when you have "a lot" of pre-SDRAM memory to use? >=20 > It depends on the architecture. For coral (and other modern x86 > devices) there is 32KB which is enough to run TPL but not enough to > run VPL. So TPL sets up 'Cache-as-RAM' which provides additional SRAM. > Other architectures may have their own constraints. And in this case then VPL sets up DRAM? > But another key difference is that we use OF_PLATDATA in TPL and that > is fine for the basic init needed there. But VPL needs lots of drivers > as well as info about the firmware image layout so it adds to the work > needed to get them running in that environment. So ideally, VPL can be > built without OF_PLATDATA. >=20 > Or put it another way, TPL needs to be as small as possible so it can > run on the widest array of devices. VPL is an optional phase (only > used with verified boot) so we should not pollute TPL with that. I > have a lot of other thoughts about all of this, some of which are in > the VBE doc... Right, the intention behind allowing "TPL" in-tree was that we have enough cases where we're size constrained and just need to allow for something "functional enough". This was what the old PowerPC "SPL" was about, and SoCs keep coming out with relatively tiny initial memory spaces. I guess my concerns at the high level fall in to a few spots: - I don't really like the idea of having to introduce yet another stage. At that point, what infrastructure from U-Boot is it really even using? - In order to use this we're now needing platforms to support TPL to add in VPL. - That kind of ties in to another part of the issue I see. Why is this not just a feature to enable in earlier stage? - Why do we have both verified and "A/B or recovery" in the same spot? Some of this I guess comes down to my thinking about how yes, x86 is constrained, but we have a lot of other platforms with 128/256/way more pre-SDRAM memory available and verified is the key feature to enable rather than A/B update. And again, what does the verified part of this provide over FIT_SIGNATURE? Outside of that A/B case, at least. --=20 Tom --lJXRn/gbbOJRxJPn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmEIP0EACgkQFHw5/5Y0 tyyXZgv+NJSWMxz/Q8xUf9iIIgCWpvowIXSNFXxKNtmQOAmOo0XeI2wZCnRyy0Fn wtYUivnVL1Efl7al+s8NmWQhgQHEmuKvPGS9n5ZCLMTimYyFZ8QSt/d5UlXuM1t4 GXlVv0tazkeIFRKdxNBO0cGKexCopveOeTVSRvXT4KylCKDVmS/QjL822SMZW+VA J0CUSnSnSDMJtZcxI8PftbnrpePu5YVLAje2MQnDQ4W62KzJg65JoZkR48PwCEa4 5VzJ9UOwgN0MPSr5j0qHB2BL8bHN+KYWusnshJl7i+F3sZ4+KKW+/UeFx0WKtkYq x+SIfFO2ncwjwIGGwi0mjW+trh2Ohg18OJF6m+YGDHZPDOcLvOTOEBvhL8eWekSq e23mvY7ls7H1WfA8jPi3qi/Cdi9xkMHBktPPlPejHWrWfeEFkhM+P1d3pHXmJE/c dL2nGv7sP6x3YmEzX4b+6HiLImgulvEPcj6RY4jgx71hx87Bbu0Z9b+W8sDmRsj3 N7qOI4xv =R99/ -----END PGP SIGNATURE----- --lJXRn/gbbOJRxJPn--