اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
GWP-ASan وKFENCE
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
أداتا GWP-ASan وKFENCE هما أداتان إحصائيتان لرصد الذاكرة في مساحة المستخدم
والنواة، على التوالي. عند تفعيل هذه الميزة، يتم
حماية عدد صغير من عمليات التوزيع باستخدام صفحات ذاكرة إضافية تحيط بالذاكرة المخصّصة.
يتيح ذلك رصد حالات تجاوز سعة المخزن المؤقت واستخدام الذاكرة بعد تحريرها بتكلفة باهظة
في الأداء. حتى مع معدّل عيّنات صغير للعمليات التي تمّت مراقبتها،
يمكن أن ترصد هذه الأدوات بفعالية أخطاء أمان الذاكرة عند نشرها على نطاق واسع.
منذ طرح هذه الأدوات، ساعدت في رصد العديد من الأخطاء في النظام الأساسي
وأثبتت أنّها أداة قيّمة لتحسين الثبات والأمان.
ونشجّع المورّدين على تفعيل هذه الميزة ومراقبة الأخطاء التي يتم رصدها على
أجهزة المستخدمين النهائيين عن كثب.
على المطوّرين التحقّق من حدوث الأعطال من خلال التحقّق من
/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 لرصد أخطاء أمان ذاكرة kernel
وفّر نظام التشغيل Android 12 واجهة KFENCE لعمليات تخصيص ملف "المكبّر" في kernel. عندما يرصد KFENCE خطأ، يسجِّل تقريرًا عن الأعطال يبدأ برمز BUG: KFENCE,
الذي يوقف صفحات الحماية ويواصل التنفيذ.
ويؤدي ذلك إلى تفعيل آلية رصد أخطاء نظام التشغيل التي تؤثر بشكلٍ بسيط في
تجربة المستخدم.
لمزيد من المعلومات حول KFENCE، يُرجى الاطّلاع على المستندات المتاحة على https://www.kernel.org.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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)"]]