In the Linux kernel, the following vulnerability has been resolved:
xen/privcmd: fix double free via VMA splitting
privcmd_vm_ops defines .close (privcmd_close), but neither .may_split
nor .open. When userspace does a partial munmap() on a privcmd mapping,
the kernel splits the VMA via __split_vma(). Since may_split is NULL,
the split is allowed. vm_area_dup() copies vm_private_data (a pages
array allocated in alloc_empty_pages()) into the new VMA without any
fixup, because there is no .open callback.
Both VMAs now point to the same pages array. When the unmapped portion
is closed, privcmd_close() calls:
- xen_unmap_domain_gfn_range()
- xen_free_unpopulated_pages()
- kvfree(pages)
The surviving VMA still holds the dangling pointer. When it is later
destroyed, the same sequence runs again, which leads to a double free.
Fix this issue by adding a .may_split callback denying the VMA split.
This is XSA-487 / CVE-2026-31787
CVE-2026-31787 is a double-free vulnerability in the Linux kernel's Xen privcmd module triggered by partial memory unmapping (munmap) operations. When userspace performs a partial munmap on a privcmd mapping, the kernel splits the VMA without proper safeguards, causing both resulting VMAs to reference the same memory pages array. This leads to a double-free condition when the VMAs are destroyed, potentially enabling local privilege escalation or denial of service. The vulnerability affects Linux kernel versions 7.1-rc1 and later, with patches available.
IMMEDIATE ACTIONS:
1. Identify all systems running Linux kernel 7.1-rc1 or later with Xen privcmd module enabled
2. Assess exposure: prioritize Xen hypervisors in multi-tenant environments and critical infrastructure
3. Restrict local user access to privcmd interfaces where possible
PATCHING GUIDANCE:
1. Apply kernel patches that add .may_split callback to privcmd_vm_ops to deny VMA splitting
2. Update to patched kernel versions (7.1-rc3 or later, or stable releases with backported fix)
3. Test patches in non-production Xen environments before deployment
4. Schedule maintenance windows for kernel updates on Xen hosts
COMPENSATING CONTROLS (if immediate patching unavailable):
1. Disable Xen privcmd module if not required: echo 'blacklist xen_privcmd' >> /etc/modprobe.d/blacklist.conf
2. Implement strict access controls to /proc/xen/privcmd
3. Restrict unprivileged user access to memory mapping operations
4. Monitor for suspicious munmap patterns on privcmd mappings
DETECTION RULES:
1. Monitor kernel logs for VMA split operations on privcmd mappings
2. Alert on double-free memory corruption errors in kernel logs
3. Track munmap syscalls targeting privcmd memory regions
4. Monitor for kernel panic/oops related to xen_free_unpopulated_pages()
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تشغل نواة لينكس 7.1-rc1 أو أحدث مع تفعيل وحدة Xen privcmd
2. تقييم التعرض: إعطاء الأولوية لمفرطات Xen في البيئات متعددة المستأجرين والبنية التحتية الحرجة
3. تقييد وصول المستخدمين المحليين إلى واجهات privcmd حيث أمكن
إرشادات التصحيح:
1. تطبيق تصحيحات النواة التي تضيف رد نداء .may_split إلى privcmd_vm_ops لرفض تقسيم VMA
2. التحديث إلى إصدارات النواة المصححة (7.1-rc3 أو أحدث، أو الإصدارات المستقرة مع التصحيح المرجعي)
3. اختبار التصحيحات في بيئات Xen غير الإنتاجية قبل النشر
4. جدولة نوافذ الصيانة لتحديثات النواة على مضيفي Xen
الضوابط البديلة:
1. تعطيل وحدة Xen privcmd إذا لم تكن مطلوبة
2. تنفيذ ضوابط وصول صارمة على /proc/xen/privcmd
3. تقييد وصول المستخدمين غير المميزين إلى عمليات خريطة الذاكرة
4. مراقبة أنماط munmap المريبة على خرائط privcmd
قواعد الكشف:
1. مراقبة سجلات النواة لعمليات تقسيم VMA على خرائط privcmd
2. تنبيهات على أخطاء تحرير الذاكرة المزدوجة في سجلات النواة
3. تتبع استدعاءات munmap syscall التي تستهدف مناطق ذاكرة privcmd
4. مراقبة حالات الذعر/oops المتعلقة بـ xen_free_unpopulated_pages()