In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix use-after-free warning in btrfs_get_or_create_delayed_node()
Previously, btrfs_get_or_create_delayed_node() set the delayed_node's
refcount before acquiring the root->delayed_nodes lock.
Commit e8513c012de7 ("btrfs: implement ref_tracker for delayed_nodes")
moved refcount_set inside the critical section, which means there is
no longer a memory barrier between setting the refcount and setting
btrfs_inode->delayed_node.
Without that barrier, the stores to node->refs and
btrfs_inode->delayed_node may become visible out of order. Another
thread can then read btrfs_inode->delayed_node and attempt to
increment a refcount that hasn't been set yet, leading to a
refcounting bug and a use-after-free warning.
The fix is to move refcount_set back to where it was to take
advantage of the implicit memory barrier provided by lock
acquisition.
Because the allocations now happen outside of the lock's critical
section, they can use GFP_NOFS instead of GFP_ATOMIC.
CVE-2025-71159 is a use-after-free vulnerability in the Linux kernel's btrfs filesystem implementation affecting kernel versions 6.19-rc1 through rc4. The vulnerability stems from a memory ordering issue in btrfs_get_or_create_delayed_node() where refcount operations lack proper synchronization, allowing concurrent threads to access uninitialized refcounts. This can lead to kernel warnings, memory corruption, and potential denial of service on systems using btrfs.
Immediate Actions:
1. Identify systems running Linux kernel versions 6.19-rc1 through 6.19-rc4 with btrfs filesystems using 'uname -r' and 'df -T'
2. Assess criticality of affected systems and plan maintenance windows
3. Implement monitoring for kernel warnings and system crashes
Patching Guidance:
1. Update to Linux kernel version 6.19-rc5 or later, or stable releases 6.18.x/6.20.x that include the fix
2. Apply the upstream patch commit that moves refcount_set back outside the critical section
3. Recompile kernel if using custom builds with btrfs support
4. Test patches in non-production environments before deployment
Compensating Controls (if immediate patching unavailable):
1. Disable btrfs on non-critical systems and migrate to ext4/XFS
2. Reduce concurrent access patterns to delayed_node operations
3. Implement kernel crash dump collection (kdump) for forensic analysis
4. Monitor system logs for 'use-after-free' warnings and kernel oops messages
Detection Rules:
1. Monitor kernel logs for: 'WARNING.*use-after-free' and 'btrfs.*delayed_node'
2. Alert on unexpected kernel panics or reboots on btrfs systems
3. Track refcount anomalies in kernel memory debugging output
4. Monitor dmesg for 'BUG: KASAN' or 'KFENCE' reports related to btrfs
الإجراءات الفورية:
1. تحديد الأنظمة التي تعمل بإصدارات نواة لينكس 6.19-rc1 إلى 6.19-rc4 مع أنظمة ملفات btrfs باستخدام 'uname -r' و 'df -T'
2. تقييم أهمية الأنظمة المتأثرة وتخطيط نوافذ الصيانة
3. تنفيذ المراقبة لتحذيرات النواة وأعطال النظام
إرشادات التصحيح:
1. التحديث إلى إصدار نواة لينكس 6.19-rc5 أو أحدث، أو الإصدارات المستقرة 6.18.x/6.20.x التي تتضمن الإصلاح
2. تطبيق رقعة المستودع الأساسي التي تنقل refcount_set خارج القسم الحرج
3. إعادة تجميع النواة إذا كنت تستخدم بناءات مخصصة مع دعم btrfs
4. اختبار الرقع في بيئات غير الإنتاج قبل النشر
الضوابط البديلة (إذا لم يكن التصحيح الفوري متاحاً):
1. تعطيل btrfs على الأنظمة غير الحرجة والهجرة إلى ext4/XFS
2. تقليل أنماط الوصول المتزامن لعمليات delayed_node
3. تنفيذ جمع تفريغ أعطال النواة (kdump) للتحليل الجنائي
4. مراقبة سجلات النظام بحثاً عن رسائل 'use-after-free' و 'kernel oops'
قواعد الكشف:
1. مراقبة سجلات النواة بحثاً عن: 'WARNING.*use-after-free' و 'btrfs.*delayed_node'
2. التنبيه على أعطال النواة غير المتوقعة أو إعادة التشغيل على أنظمة btrfs
3. تتبع شذوذ العد المرجعي في مخرجات تصحيح ذاكرة النواة
4. مراقبة dmesg بحثاً عن تقارير 'BUG: KASAN' أو 'KFENCE' المتعلقة بـ btrfs