ANDROID: AVB error handler to invalidate vbmeta partition.

If androidboot.vbmeta.invalidate_on_error is 'yes' and
androidboot.vbmeta.device is set and points to a device with vbmeta
magic, this header will be overwritten upon an irrecoverable dm-verity
error. The side-effect of this is that the slot will fail to verify on
next reboot, effectively triggering the boot loader to fallback to
another slot. This work both if the vbmeta struct is at the start of a
partition or if there's an AVB footer at the end.

This code is based on drivers/md/dm-verity-chromeos.c from ChromiumOS.

Bug: 31622239
Test: Manually tested (other arch).
Change-Id: I571b5a75461da38ad832a9bea33c298bef859e26
Signed-off-by: David Zeuthen <zeuthen@google.com>
5 files changed