blob: 05c034f0723633681cd3ddf2fe3cb617931d3e00 [file] [log] [blame]
Clay Murphye42ff9e2015-03-23 12:40:25 -07001page.title=Verified Boot
Clay Murphy750e4982013-10-21 13:09:55 -07002@jd:body
3
4<!--
Clay Murphyfcf8f182015-03-11 22:43:31 -07005 Copyright 2015 The Android Open Source Project
Clay Murphy750e4982013-10-21 13:09:55 -07006
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18-->
19<div id="qv-wrapper">
20 <div id="qv">
21 <h2>In this document</h2>
22 <ol id="auto-toc">
23 </ol>
24 </div>
25</div>
26
27<h2 id="introduction">Introduction</h2>
28
Heidi von Markham352a0122015-10-09 12:28:34 -070029<p>Android 4.4 and later supports verified boot through the optional
30device-mapper-verity (dm-verity) kernel feature, which provides transparent
31integrity checking of block devices. dm-verity helps prevent persistent rootkits
32that can hold onto root privileges and compromise devices. This experimental
33feature helps Android users be sure when booting a device it is in the same
34state as when it was last used.</p>
Clay Murphy750e4982013-10-21 13:09:55 -070035
Heidi von Markham352a0122015-10-09 12:28:34 -070036<p>Clever malware with root privileges can hide from detection programs and
37otherwise mask themselves. The rooting software can do this because it is often
38more privileged than the detectors, enabling the software to "lie" to the
Clay Murphy750e4982013-10-21 13:09:55 -070039detection programs.</p>
40
Heidi von Markham352a0122015-10-09 12:28:34 -070041<p>The dm-verity feature lets you look at a block device, the underlying storage
42layer of the file system, and determine if it matches its expected
43configuration. It does this using a cryptographic hash tree. For every block
Clay Murphy750e4982013-10-21 13:09:55 -070044(typically 4k), there is a SHA256 hash.</p>
45
Heidi von Markham352a0122015-10-09 12:28:34 -070046<p>Since the hash values are stored in a tree of pages, only the top-level
47"root" hash must be trusted to verify the rest of the tree. The ability to
48modify any of the blocks would be equivalent to breaking the cryptographic hash.
Clay Murphy750e4982013-10-21 13:09:55 -070049See the following diagram for a depiction of this structure.</p>
50
Clay Murphy1b77cc22014-12-17 18:20:06 -080051<img src="../images/dm-verity-hash-table.png" alt="dm-verity-hash-table" id="figure1"/>
52<p class="img-caption">
53 <strong>Figure 1.</strong> dm-verity hash table
54</p>
55
Heidi von Markham352a0122015-10-09 12:28:34 -070056<p>A public key is included on the boot partition, which must be verified
57externally by the OEM. That key is used to verify the signature for that hash
Clay Murphy750e4982013-10-21 13:09:55 -070058and confirm the device's system partition is protected and unchanged.</p>
59
Clay Murphy750e4982013-10-21 13:09:55 -070060<h2 id="prerequisites">Prerequisites</h2>
61
Clay Murphybb696e52014-12-05 15:49:04 -080062<h3 id="verified-boot">Establishing a verified boot flow</h3>
63<p>To greatly reduce the risk of compromise, verify the kernel using a key
Heidi von Markham352a0122015-10-09 12:28:34 -070064burned into the device. For details, see <a href="verified-boot.html">Verified
65boot</a>.</p>
Clay Murphybb696e52014-12-05 15:49:04 -080066
Clay Murphy750e4982013-10-21 13:09:55 -070067<h3 id="block-otas">Switching to block-oriented OTAs</h3>
Clay Murphybb696e52014-12-05 15:49:04 -080068<p>To enable dm-verity for a device, you must use block-based over-the-air
69(OTA) updates to ensure all devices use the same system partition. For details,
Clay Murphy4ddf3ad2015-03-18 14:38:41 -070070see <a href="{@docRoot}devices/tech/ota/block.html">Block-Based OTAs</a>.</p>
Clay Murphy750e4982013-10-21 13:09:55 -070071
72<h3 id="config-dm-verity">Configuring dm-verity</h3>
73
Heidi von Markham352a0122015-10-09 12:28:34 -070074<p>After switching to block-oriented OTAs, incorporate the latest Android kernel
75or use a stock upstream kernel and enable dm-verity support by including the
76relevant configuration option <code>CONFIG_DM_VERITY</code>.</p>
77
78<p>When using the Android kernel, dm-verity is turned on when the kernel is
79built. For details, see <a href="dm-verity.html">Implementing dm-verity</a>.</p>
Clay Murphy750e4982013-10-21 13:09:55 -070080
81<h2 id="supporting-docs">Supporting documentation</h2>
Clay Murphyfcf8f182015-03-11 22:43:31 -070082<p><a href="verified-boot.html">Verifying Boot</a><br/>
Clay Murphy4ddf3ad2015-03-18 14:38:41 -070083<a href="{@docRoot}devices/tech/ota/block.html">Block-Based OTA</a><br/>
Clay Murphyfcf8f182015-03-11 22:43:31 -070084<a href="dm-verity.html">Implementing dm-verity</a><br/>
Heidi von Markham352a0122015-10-09 12:28:34 -070085<a href="https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity">cryptsetup -
86dm-verity: device-mapper block integrity checking target</a><br/>
87<a href="http://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot">The
88Chromium Projects - Verified Boot</a><br/>
Clay Murphy750e4982013-10-21 13:09:55 -070089<a
Heidi von Markham352a0122015-10-09 12:28:34 -070090href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/device-mapper/verity.txt">Linux Kernel Documentation: verity.txt</a></p>