2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
GWP-ASan と KFENCE
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
GWP-ASan と KFENCE は、それぞれユーザー空間とカーネルの確率論的メモリ検出ツールです。有効にすると、少数の割り当てが、割り当てられたメモリを囲む追加のメモリページによって保護されます。これにより、無視できるほどわずかなパフォーマンス オーバーヘッドでバッファ オーバーフローと解放後の使用を検出できます。保護された割り当てのサンプルレートが小さくても、大規模にデプロイすれば、メモリ安全性のバグを効果的に検出できます。導入以来、これらのツールは数多くのプラットフォームのバグの特定に役立っており、安定性とセキュリティを向上させる貴重なツールであることが証明されています。Google はベンダーに対し、これらのツールを有効にして、エンドユーザー デバイスで検出されたバグを注意深くモニタリングすることをおすすめします。
デベロッパーは、/data/tombstones
、logcat
をチェックするか、ベンダーの DropboxManager
パイプラインでエンドユーザーのバグをモニタリングして、クラッシュがないか確認してください。
詳細については、Android ネイティブ コードのデバッグに関するドキュメントをご覧ください。
ネイティブ Android プラットフォーム コードのデバッグarrow_forward
ユーザー空間のメモリ安全性のバグを検出する GWP-ASan
GWP-ASan は、ユーザー空間のヒープ割り当てのために Android 11 で導入されました。GWP-ASan はバグを検出すると Cause: [GWP-ASan]:
でクラッシュ レポートを記録し、プロセスを終了させます。バグレポートには割り当てと割り当て解除に関する補足情報が含まれており、根本原因を特定しやすくなっています。
GWP-ASan は起動時に、システム プロセスまたはアプリの 1% と、AndroidManifest.xml
ファイルで android:gwpAsanMode
が設定されているアプリに対して、ランダムに有効になります。
GWP-ASanarrow_forward
カーネルのメモリ安全性のバグを検出する KFENCE
Android 12 では、カーネルのヒープ割り当てに KFENCE が導入されました。KFENCE はバグを検出すると BUG: KFENCE,
で始まるクラッシュ レポートを記録し、ガードページを無効にして実行を継続します。これにより、ユーザー エクスペリエンスにほとんど影響を与えないカーネルのバグ検出メカニズムが実現します。
KFENCE の詳細については、https://www.kernel.org にあるドキュメントをご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 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-07-27 UTC。"],[],[],null,["# GWP-ASan and KFENCE are probabilistic memory detection tools for userspace\nand the kernel, respectively. When enabled, a small number of allocations are\nguarded with additional memory pages that surround the allocated memory.\nThis allows detecting buffer overflows and use-after-frees at a negligible\nperformance overhead. Even with a small sample rate for the guarded allocations,\nwhen deployed at scale they can effectively detect memory safety bugs.\nSince their introduction these tools have helped identify numerous platform\nbugs and have proved to be a valuable tool for improving stability and security.\nWe encourage vendors to enable them and to closely monitor the bugs detected on\nend user devices.\n\n\nDevelopers should check the presence of crashes by checking\n`/data/tombstones`, `logcat` or by monitoring the vendor\n[DropboxManager](https://developer.android.com/reference/android/os/DropBoxManager)\npipeline for end user bugs.\n\n\nFor more information see our docs on debugging Android native\ncode.\n[Debugging Native Android Platform Codearrow_forward](/docs/core/tests/debug)\n\nGWP-ASan for detecting userspace memory safety bugs\n---------------------------------------------------\n\n\nGWP-ASan was introduced in Android 11 for userspace\nheap allocations. When GWP-ASan detects a bug, it records a crash report with\n`Cause: [GWP-ASan]:` and terminates the process. The bug reports\ncontain additional allocation and deallocation information that make it easier\nto identify the root cause.\n\n\nGWP-ASan is randomly enabled, at start-up, for 1% of system processes or\napps and for applications that set the `android:gwpAsanMode` in their\n`AndroidManifest.xml` file.\n[GWP-ASanarrow_forward](https://developer.android.com/ndk/guides/gwp-asan)\n\nKFENCE for detecting kernel memory safety bugs\n----------------------------------------------\n\n\nAndroid 12 introduced KFENCE for kernel heap\nallocations. When KFENCE detects a bug, it records a crash report starting\nwith `BUG: KFENCE,` disables the guard pages and continues execution.\nThis enables a kernel bug detection mechanism that minimally impacts the user\nexperience.\n\n\nTo learn more about KFENCE see the documentation available at [https://www.kernel.org](https://www.kernel.org/doc/html/latest/dev-tools/kfence.html)"]]