All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>,
	u-boot@lists.u-boot-project.org
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Shahriyar Jalayeri <shahriyar@byteray.co.uk>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Subject: Re: [PATCH v2 0/5] avb: device lock state, root key provisioning and in-place verification
Date: Tue, 20 Oct 2026 09:21:11 +0200	[thread overview]
Message-ID: <xhkdb7bjc6dnc.fsf@mkorpers-koolstof.csb> (raw)
In-Reply-To: <20261012-upstream-avb_lock_unlock_b4-v2-0-87460a24e559@oss.qualcomm.com>

Hi Igor,

Thank you for the series

On Mon, Oct 12, 2026 at 22:25, Igor Opaniuk <igor.opaniuk@oss.qualcomm.com> wrote:

> This series completes the device state handling of the AVB 2.0
> implementation when the state is kept by the OP-TEE AVB TA, and fixes
> the way the Android bootmeth hands the boot images to libavb.
>
> Patches 1 and 2 add the shell side: "avb read_pvalue_hex" and
> "avb write_pvalue_hex" provision binary persistent values such as the
> SHA-256 digest of the vbmeta signing key that CONFIG_AVB_ROOT_KEY_TEE
> consumes, and "avb lock"/"avb unlock" set the lock state through a new
> avb_write_lock_state() helper. Until now U-Boot could only read the
> lock state, so a device backed by the TA could never leave the unlocked
> (orange) state.
>
> Patch 3 makes bootmeth_android verify the boot images in the buffers it
> boots them from, via AvbOps.get_preloaded_partition(), instead of
> letting libavb read, hash and free its own copies and then reading the
> partitions a second time for booting. This closes the TOCTOU window
> reported on the list and halves the amount of data read from storage.
>
> Patch 4 adds "fastboot flashing lock|unlock|get_unlock_ability" and the
> "unlocked" variable, so the state can be changed with the Android
> fastboot tool. Both transitions erase userdata and metadata before the
> state changes, as AVB requires.
>
> Patch 5 documents the root key sources, the provisioning of the TEE
> digest and the lock state in doc/android/avb2.rst.
>
> Tested on QEMU virt with OP-TEE 4.11.0-rc1 and the Cuttlefish Android
> 17 images: the chain boots locked (green) to sys.boot_completed, a
> modified kernel is refused, "fastboot flashing unlock/lock" over
> "fastboot tcp" erase the partitions and flip the state reported by
> "getvar unlocked" and "avb is_unlocked", and QEMU's SD card block trace
> shows every sector of boot and vendor_boot read exactly once.
>
> The lock state is stored in RPMB by the TA; on boards where U-Boot
> serves the RPMB requests of OP-TEE itself, the two fixes in "optee: two
> RPMB fixes for RPMB requests served by U-Boot" are needed at run time.
> There is no build dependency.
>
> Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>

Boot tested this on khadas-vim3_android_ab_defconfig using the following
AOSP images:
http://public.amlogic.binaries.baylibre.com/ci/build/baylibre/2026-09-17/2026-09-17_yukawa-bp2a-userdebug_vim3_yukawa-android-16_mainline_b25.tar.gz

Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org>


      parent reply	other threads:[~2026-10-20  7:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 20:25 [PATCH v2 0/5] avb: device lock state, root key provisioning and in-place verification Igor Opaniuk
2026-10-12 20:25 ` [PATCH v2 1/5] cmd: avb: add read_pvalue_hex/write_pvalue_hex Igor Opaniuk
2026-10-20  7:38   ` Mattijs Korpershoek
2026-10-20 10:33   ` Guillaume La Roque
2026-10-12 20:25 ` [PATCH v2 2/5] cmd: avb: add lock/unlock commands Igor Opaniuk
2026-10-20  7:41   ` Mattijs Korpershoek
2026-10-20 10:33   ` Guillaume La Roque
2026-10-12 20:25 ` [PATCH v2 3/5] avb: verify the boot images in the buffers they are booted from Igor Opaniuk
2026-10-20  7:53   ` Mattijs Korpershoek
2026-10-20 10:33   ` Guillaume La Roque
2026-10-12 20:25 ` [PATCH v2 4/5] fastboot: add flashing lock/unlock/get_unlock_ability Igor Opaniuk
2026-10-20  8:23   ` Mattijs Korpershoek
2026-10-20 10:33   ` Guillaume La Roque
2026-10-12 20:25 ` [PATCH v2 5/5] doc: android/avb2: document the root key provisioning and lock state Igor Opaniuk
2026-10-20  8:27   ` Mattijs Korpershoek
2026-10-20 10:33   ` Guillaume La Roque
2026-10-19  6:51 ` [PATCH v2 0/5] avb: device lock state, root key provisioning and in-place verification Igor Opaniuk
2026-10-20  7:21 ` Mattijs Korpershoek [this message]

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=xhkdb7bjc6dnc.fsf@mkorpers-koolstof.csb \
    --to=mkorpershoek@kernel.org \
    --cc=a.fatoum@pengutronix.de \
    --cc=igor.opaniuk@oss.qualcomm.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=pengpeng@iscas.ac.cn \
    --cc=quentin.schulz@cherry.de \
    --cc=shahriyar@byteray.co.uk \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /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.