Clay Murphy | e42ff9e | 2015-03-23 12:40:25 -0700 | [diff] [blame] | 1 | page.title=Verified Boot |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 2 | @jd:body |
| 3 | |
| 4 | <!-- |
Clay Murphy | fcf8f18 | 2015-03-11 22:43:31 -0700 | [diff] [blame] | 5 | Copyright 2015 The Android Open Source Project |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 6 | |
| 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 | |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 27 | <p>Android 4.4 and later supports verified boot through the optional |
| 28 | device-mapper-verity (dm-verity) kernel feature, which provides transparent |
| 29 | integrity checking of block devices. dm-verity helps prevent persistent rootkits |
Danielle Roberts | 1a1441a | 2016-06-17 13:50:20 -0700 | [diff] [blame] | 30 | that can hold onto root privileges and compromise devices. This |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 31 | feature helps Android users be sure when booting a device it is in the same |
| 32 | state as when it was last used.</p> |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 33 | |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 34 | <p>Clever malware with root privileges can hide from detection programs and |
| 35 | otherwise mask themselves. The rooting software can do this because it is often |
| 36 | more privileged than the detectors, enabling the software to "lie" to the |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 37 | detection programs.</p> |
| 38 | |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 39 | <p>The dm-verity feature lets you look at a block device, the underlying storage |
| 40 | layer of the file system, and determine if it matches its expected |
| 41 | configuration. It does this using a cryptographic hash tree. For every block |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 42 | (typically 4k), there is a SHA256 hash.</p> |
| 43 | |
Danielle Roberts | 1a1441a | 2016-06-17 13:50:20 -0700 | [diff] [blame] | 44 | <p>Because the hash values are stored in a tree of pages, only the top-level |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 45 | "root" hash must be trusted to verify the rest of the tree. The ability to |
| 46 | modify any of the blocks would be equivalent to breaking the cryptographic hash. |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 47 | See the following diagram for a depiction of this structure.</p> |
| 48 | |
Clay Murphy | 1b77cc2 | 2014-12-17 18:20:06 -0800 | [diff] [blame] | 49 | <img src="../images/dm-verity-hash-table.png" alt="dm-verity-hash-table" id="figure1"/> |
| 50 | <p class="img-caption"> |
| 51 | <strong>Figure 1.</strong> dm-verity hash table |
| 52 | </p> |
| 53 | |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 54 | <p>A public key is included on the boot partition, which must be verified |
| 55 | externally by the OEM. That key is used to verify the signature for that hash |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 56 | and confirm the device's system partition is protected and unchanged.</p> |
| 57 | |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 58 | <h2 id="prerequisites">Prerequisites</h2> |
| 59 | |
Clay Murphy | bb696e5 | 2014-12-05 15:49:04 -0800 | [diff] [blame] | 60 | <h3 id="verified-boot">Establishing a verified boot flow</h3> |
| 61 | <p>To greatly reduce the risk of compromise, verify the kernel using a key |
Danielle Roberts | 1a1441a | 2016-06-17 13:50:20 -0700 | [diff] [blame] | 62 | burned into the device. For details, see <a href="verified-boot.html">Verifying |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 63 | boot</a>.</p> |
Clay Murphy | bb696e5 | 2014-12-05 15:49:04 -0800 | [diff] [blame] | 64 | |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 65 | <h3 id="block-otas">Switching to block-oriented OTAs</h3> |
Clay Murphy | bb696e5 | 2014-12-05 15:49:04 -0800 | [diff] [blame] | 66 | <p>To enable dm-verity for a device, you must use block-based over-the-air |
| 67 | (OTA) updates to ensure all devices use the same system partition. For details, |
Clay Murphy | 4ddf3ad | 2015-03-18 14:38:41 -0700 | [diff] [blame] | 68 | see <a href="{@docRoot}devices/tech/ota/block.html">Block-Based OTAs</a>.</p> |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 69 | |
| 70 | <h3 id="config-dm-verity">Configuring dm-verity</h3> |
| 71 | |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 72 | <p>After switching to block-oriented OTAs, incorporate the latest Android kernel |
| 73 | or use a stock upstream kernel and enable dm-verity support by including the |
| 74 | relevant configuration option <code>CONFIG_DM_VERITY</code>.</p> |
| 75 | |
| 76 | <p>When using the Android kernel, dm-verity is turned on when the kernel is |
| 77 | built. For details, see <a href="dm-verity.html">Implementing dm-verity</a>.</p> |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 78 | |
| 79 | <h2 id="supporting-docs">Supporting documentation</h2> |
Clay Murphy | fcf8f18 | 2015-03-11 22:43:31 -0700 | [diff] [blame] | 80 | <p><a href="verified-boot.html">Verifying Boot</a><br/> |
Clay Murphy | 4ddf3ad | 2015-03-18 14:38:41 -0700 | [diff] [blame] | 81 | <a href="{@docRoot}devices/tech/ota/block.html">Block-Based OTA</a><br/> |
Clay Murphy | fcf8f18 | 2015-03-11 22:43:31 -0700 | [diff] [blame] | 82 | <a href="dm-verity.html">Implementing dm-verity</a><br/> |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 83 | <a href="https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity">cryptsetup - |
| 84 | dm-verity: device-mapper block integrity checking target</a><br/> |
| 85 | <a href="http://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot">The |
| 86 | Chromium Projects - Verified Boot</a><br/> |
Clay Murphy | 750e498 | 2013-10-21 13:09:55 -0700 | [diff] [blame] | 87 | <a |
Heidi von Markham | 352a012 | 2015-10-09 12:28:34 -0700 | [diff] [blame] | 88 | href="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> |