CHROMIUM: dm-verity: add a chromeos-specific error target
authorWill Drewry <wad@chromium.org>
Tue, 11 Jan 2011 18:46:18 +0000 (12:46 -0600)
committerOlof Johansson <olof@lixom.net>
Fri, 1 Jun 2012 06:59:33 +0000 (23:59 -0700)
commit63d4c2e71e0e07e8af24734c134b61088c271423
tree939cec67f3b3b5704ea81d96944409f308f75cf1
parentecaac24f398e584e62183dfaf2aed745d58c9f34
CHROMIUM: dm-verity: add a chromeos-specific error target

Adds a "cros" error target that will write DMVERROR to the first 8
bytes of the partition preceding the configured target (e.g., /dev/sda3-/dev/sda2)
if it contains CHROMEOS already.  If the error is non-terminal (ENOMEM, transient I/O
failure, etc) it will just panic.

If failure to read/write to the kernel partition occurs, it will trigger a
reboot-to-recovery.

TEST=built a recovery kernel and make a dev_shim to boot to a shell. From there I setup a dm-verity device fro the sda3 on the installed system.  I gave it an invalid root hash.  I then mounted the dm-0 device which triggered a failure during validation.  It properly invalidated the kernel partition.
BUG=chromium-os:8442

Change-Id: I6aa095b976a20ab444fb7b1188fe9e2d55403b39
Signed-off-by: Will Drewry <wad@chromium.org>
Review URL: http://codereview.chromium.org/4430004
(copied from kernel.git)

Review URL: http://codereview.chromium.org/6147002
drivers/md/dm-verity.c