CVE-2024-26944

Severity CVSS v4.0:
Pending analysis
Type:
CWE-416 Use After Free
Publication date:
01/05/2024
Last modified:
01/12/2025

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> btrfs: zoned: fix use-after-free in do_zone_finish()<br /> <br /> Shinichiro reported the following use-after-free triggered by the device<br /> replace operation in fstests btrfs/070.<br /> <br /> BTRFS info (device nullb1): scrub: finished on devid 1 with status: 0<br /> ==================================================================<br /> BUG: KASAN: slab-use-after-free in do_zone_finish+0x91a/0xb90 [btrfs]<br /> Read of size 8 at addr ffff8881543c8060 by task btrfs-cleaner/3494007<br /> <br /> CPU: 0 PID: 3494007 Comm: btrfs-cleaner Tainted: G W 6.8.0-rc5-kts #1<br /> Hardware name: Supermicro Super Server/X11SPi-TF, BIOS 3.3 02/21/2020<br /> Call Trace:<br /> <br /> dump_stack_lvl+0x5b/0x90<br /> print_report+0xcf/0x670<br /> ? __virt_addr_valid+0x200/0x3e0<br /> kasan_report+0xd8/0x110<br /> ? do_zone_finish+0x91a/0xb90 [btrfs]<br /> ? do_zone_finish+0x91a/0xb90 [btrfs]<br /> do_zone_finish+0x91a/0xb90 [btrfs]<br /> btrfs_delete_unused_bgs+0x5e1/0x1750 [btrfs]<br /> ? __pfx_btrfs_delete_unused_bgs+0x10/0x10 [btrfs]<br /> ? btrfs_put_root+0x2d/0x220 [btrfs]<br /> ? btrfs_clean_one_deleted_snapshot+0x299/0x430 [btrfs]<br /> cleaner_kthread+0x21e/0x380 [btrfs]<br /> ? __pfx_cleaner_kthread+0x10/0x10 [btrfs]<br /> kthread+0x2e3/0x3c0<br /> ? __pfx_kthread+0x10/0x10<br /> ret_from_fork+0x31/0x70<br /> ? __pfx_kthread+0x10/0x10<br /> ret_from_fork_asm+0x1b/0x30<br /> <br /> <br /> Allocated by task 3493983:<br /> kasan_save_stack+0x33/0x60<br /> kasan_save_track+0x14/0x30<br /> __kasan_kmalloc+0xaa/0xb0<br /> btrfs_alloc_device+0xb3/0x4e0 [btrfs]<br /> device_list_add.constprop.0+0x993/0x1630 [btrfs]<br /> btrfs_scan_one_device+0x219/0x3d0 [btrfs]<br /> btrfs_control_ioctl+0x26e/0x310 [btrfs]<br /> __x64_sys_ioctl+0x134/0x1b0<br /> do_syscall_64+0x99/0x190<br /> entry_SYSCALL_64_after_hwframe+0x6e/0x76<br /> <br /> Freed by task 3494056:<br /> kasan_save_stack+0x33/0x60<br /> kasan_save_track+0x14/0x30<br /> kasan_save_free_info+0x3f/0x60<br /> poison_slab_object+0x102/0x170<br /> __kasan_slab_free+0x32/0x70<br /> kfree+0x11b/0x320<br /> btrfs_rm_dev_replace_free_srcdev+0xca/0x280 [btrfs]<br /> btrfs_dev_replace_finishing+0xd7e/0x14f0 [btrfs]<br /> btrfs_dev_replace_by_ioctl+0x1286/0x25a0 [btrfs]<br /> btrfs_ioctl+0xb27/0x57d0 [btrfs]<br /> __x64_sys_ioctl+0x134/0x1b0<br /> do_syscall_64+0x99/0x190<br /> entry_SYSCALL_64_after_hwframe+0x6e/0x76<br /> <br /> The buggy address belongs to the object at ffff8881543c8000<br /> which belongs to the cache kmalloc-1k of size 1024<br /> The buggy address is located 96 bytes inside of<br /> freed 1024-byte region [ffff8881543c8000, ffff8881543c8400)<br /> <br /> The buggy address belongs to the physical page:<br /> page:00000000fe2c1285 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1543c8<br /> head:00000000fe2c1285 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0<br /> flags: 0x17ffffc0000840(slab|head|node=0|zone=2|lastcpupid=0x1fffff)<br /> page_type: 0xffffffff()<br /> raw: 0017ffffc0000840 ffff888100042dc0 ffffea0019e8f200 dead000000000002<br /> raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000<br /> page dumped because: kasan: bad access detected<br /> <br /> Memory state around the buggy address:<br /> ffff8881543c7f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br /> ffff8881543c7f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br /> &gt;ffff8881543c8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb<br /> ^<br /> ffff8881543c8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb<br /> ffff8881543c8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb<br /> <br /> This UAF happens because we&amp;#39;re accessing stale zone information of a<br /> already removed btrfs_device in do_zone_finish().<br /> <br /> The sequence of events is as follows:<br /> <br /> btrfs_dev_replace_start<br /> btrfs_scrub_dev<br /> btrfs_dev_replace_finishing<br /> btrfs_dev_replace_update_device_in_mapping_tree

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.16 (including) 6.8.3 (excluding)
cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:*