החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
GWP-ASan ו-KFENCE
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
GWP-ASan ו-KFENCE הם כלים סטטיסטיים לזיהוי זיכרון במרחב המשתמש ובליבה, בהתאמה. כשהאפשרות הזו מופעלת, מספר קטן של הקצאות מוגנות באמצעות דפי זיכרון נוספים שמקיפים את הזיכרון שהוקצה.
כך אפשר לזהות זליגות מאגרים (buffer overflows) ושימוש לאחר שחרור (use-after-frees) בעלות ביצועים זניחה. גם עם שיעור דגימה קטן להקצאות המוגנות, כשפורסים אותן בקנה מידה רחב הן יכולות לזהות באגים בטיחותיים בזיכרון בצורה יעילה.
מאז ההשקה שלהם, הכלים האלה עזרו לזהות מספר רב של באגים בפלטפורמה והם הוכיחו את עצמם ככלי חשוב לשיפור היציבות והאבטחה.
אנחנו ממליצים לספקים להפעיל אותם ולעקוב מקרוב אחרי הבאגים שזוהו במכשירי משתמשי הקצה.
המפתחים צריכים לבדוק אם יש קריסות על ידי בדיקה של /data/tombstones
או logcat
, או על ידי מעקב אחרי צינור עיבוד הנתונים של הספק DropboxManager
כדי לאתר באגים של משתמשי קצה.
מידע נוסף זמין במסמכים שלנו בנושא ניפוי באגים בקוד מקורי ל-Android.
ניפוי באגים בקוד של פלטפורמת Android מקוריתarrow_forward
GWP-ASan לזיהוי באגים של בטיחות זיכרון במרחב המשתמש
GWP-ASan הוצג ב-Android 11 להקצאות אשכול במרחב המשתמש. כש-GWP-ASan מזהה באג, הוא מתעד דוח קריסה עם Cause: [GWP-ASan]:
ומפסיק את התהליך. דוחות הבאגים מכילים מידע נוסף על הקצאה ועל ביטול הקצאה, שעוזר לזהות את הגורם לבעיה.
GWP-ASan מופעל באופן אקראי בזמן ההפעלה, ב-1% מהתהליכים או מהאפליקציות במערכת, ובאפליקציות שמגדירות את הערך android:gwpAsanMode
בקובץ AndroidManifest.xml
.
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)"]]