2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
確認付きブート
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
確認付きブートでは、起動する Android バージョンの一部であるすべての実行可能なコードとデータを、使用前に暗号的に確認する必要があります。これには、カーネル(boot
パーティションから読み込み)、デバイスツリー(dtbo
パーティションから読み込み)、system
パーティション、vendor
パーティションなどがあります。
boot
や dtbo
などの、1 回しか読み込まれない小さなパーティションの確認では、通常は内容全体をメモリに読み込んでハッシュを計算します。この計算されたハッシュ値は、「予想ハッシュ値」と比較されます。値が一致しない場合、Android は読み込まれません。
詳細については、起動フローをご覧ください。
メモリに収まらない大きなパーティション(ファイルシステムなど)ではハッシュツリーを使用する場合があります。この場合、確認処理は、データがメモリに読み込まれると発生する連続した処理となります。このような場合は、ハッシュツリーのルートハッシュは実行時に計算され、「予想ルートハッシュ値」と照合されます。
Android には dm-verity ドライバがあり、大きなパーティションを確認できます。計算されたルートハッシュが「予想ルートハッシュ値」と一致しない場合、データは使用されず、Android はエラー状態になります。詳細については、dm-verity の破損をご覧ください。
「予想ハッシュ」は通常、確認済みの各パーティションの末尾または先頭、または専用のパーティション、またはその両方に格納されます。重要なのは、これらのハッシュがルート オブ トラストにより(直接的または間接的に)署名されることです。例として、AVB 実装はどちらの方法もサポートしています。Android の確認付きブートをご覧ください。
ロールバック保護
アップデート プロセスが完全に安全であっても、永続的な Android カーネルを悪用して、古くて脆弱な Android バージョンを手動でインストールし、その Android バージョンで再起動して永続的な弱点を作ることができます。そこから、攻撃者はデバイスを恒久的に所有し、アップデートを無効にするなど、何でもできるようになります。
このような攻撃からの保護は「ロールバック保護」と呼ばれます。ロールバック保護では、通常、改ざん検出可能なストレージを使用して Android の最新バージョンを記録し、起動に使用する Android のバージョンが記録されているバージョンより低ければ起動を拒否します。通常、バージョンはパーティションごとに追跡されます。
AVB がロールバック保護を処理する方法の詳細については、AVB README を参照してください。
確認エラーを処理する
検証は起動時(boot
パーティションで計算されたハッシュが予想ハッシュと一致しない場合など)や実行時(system
パーティションで dm-verity の検証エラーが発生した場合など)に失敗することがあります。起動時に検証が失敗すると、デバイスは起動できず、エンドユーザーはデバイスの復旧処理を行う必要があります。
検証が実行時に失敗した場合、フローはもう少し複雑になります。デバイスが dm-verity を使用している場合は、restart
モードで設定する必要があります。restart
モードでは、検証エラーが発生した場合、デバイスは直ちに再起動され、その理由を示す特定のフラグが設定されます。ブートローダーはこのフラグを認識し、dm-verity が入出力エラー(eio
)モードを使用するよう切り替えます。新しいアップデートがインストールされるまでこのモードは維持されます。
eio
モードで起動する場合、デバイスにはエラー画面が表示され、破損が検出されたことと、デバイスが正常に機能しない可能性があることをユーザーに通知します。この画面はユーザーが閉じるまで表示されます。eio
モードでは、検証エラーが発生した場合 dm-verity ドライバはデバイスを再起動しません。代わりに EIO エラーが返され、アプリはこのエラーを処理する必要があります。
これは、システム アップデートが実行される(新しい OS のインストール時に破損エラーが発生しない)ようにするため、あるいはユーザーがデバイスから可能な限り多くのデータを得られるようにするためです。新しい OS がインストールされると、ブートローダーは新しくインストールされた OS を認識し、restart
モードに戻ります。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# Verify Boot\n\nVerified Boot requires cryptographically verifying all executable code and data\nthat is part of the Android version being booted before it is used. This includes\nthe kernel (loaded from the `boot` partition), the device tree (loaded\nfrom the `dtbo` partition), `system` partition,\n`vendor` partition, and so on.\n\n\nSmall partitions, such as `boot` and `dtbo`, that are read\nonly once are typically verified by loading the entire contents into memory and\nthen calculating its hash. This calculated hash value is then compared to the\n*expected hash value* . If the value doesn't match, Android won't load.\nFor more details, see [Boot Flow](/docs/security/features/verifiedboot/boot-flow).\n\n\nLarger partitions that won't fit into memory (such as, file systems) may use\na hash tree where verification is a continuous process happening as data is\nloaded into memory. In this case, the root hash of the hash tree is calculated\nduring run time and is checked against the *expected root hash value* .\nAndroid includes the [dm-verity\ndriver](/docs/security/features/verifiedboot/dm-verity) to verify larger partitions. If at some point the calculated root\nhash doesn't match the *expected root hash value* , the data isn't used\nand Android enters an error state. For more details, see\n[dm-verity\ncorruption](/docs/security/features/verifiedboot/boot-flow#dm-verity-corruption).\n\n\nThe *expected hashes* are typically stored at either the end or beginning\nof each verified partition, in a dedicated partition, or both. Crucially, these\nhashes are signed (either directly or indirectly) by the root of trust. As an\nexample, the AVB implementation supports both approaches, see\n[Android Verified Boot](/docs/security/features/verifiedboot/avb) for details.\n\nRollback protection\n-------------------\n\n\nEven with a completely secure update process, it's possible for a non-persistent\nAndroid kernel exploit to manually install an older, more vulnerable version of\nAndroid, reboot into the vulnerable version, and then use that Android version to\ninstall a persistent exploit. From there the attacker permanently owns the device\nand can do anything, including disabling updates.\n\n\nThe protection against this class of attacks is called *Rollback\nProtection*. Rollback protection is typically implemented by using\ntamper-evident storage to record the most recent version of the Android and\nrefusing to boot Android if it's lower than the recorded version. Versions\nare typically tracked on a per-partition basis.\n\n\nFor more details on how AVB handles rollback protections, see the AVB\n[README](https://android.googlesource.com/platform/external/avb/+/android16-release/README.md#Rollback-Protection).\n\nHandle verification errors\n--------------------------\n\n\nVerification can fail either at boot time (such as, if the calculated hash on\n`boot` partition doesn't match the expected hash) or at run time\n(such as, if dm-verity encounters a verification error on the\n`system` partition). If verification fails at boot time, the device\ncan't boot and the end user needs to go through steps to recover the device.\n\n\nIf verification fails at run-time the flow is a bit more complicated. If the\ndevice uses dm-verity, it should be configured in `restart` mode. In\n`restart` mode, if a verification error is encountered, the device is\nimmediately restarted with a specific flag set to indicate the reason. The boot\nloader should notice this flag and switch dm-verity over to use I/O Error\n(`eio`) mode and stay in this mode until a new update has been\ninstalled.\n\n\nWhen booting in `eio` mode, the device shows an error screen\ninforming the user that corruption has been detected and the device might not\nfunction correctly. The screen shows until the user dismisses it. In\n`eio` mode the dm-verity driver won't restart the device if a\nverification error is encountered, instead an EIO error is returned and the\napp needs to deal with the error.\n\n\nThe intent is that either the system updater will run (so a new OS without\ncorruption errors can be installed) or the user can get as much of their data\noff the device as possible. Once the new OS has been installed, the boot loader\nnotices the newly installed OS and switches back to `restart` mode."]]