CVE-2023-53187
Gravedad:
Pendiente de análisis
Tipo:
No Disponible / Otro tipo
Fecha de publicación:
15/09/2025
Última modificación:
15/09/2025
Descripción
*** Pendiente de traducción *** In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
btrfs: fix use-after-free of new block group that became unused<br />
<br />
If a task creates a new block group and that block group becomes unused<br />
before we finish its creation, at btrfs_create_pending_block_groups(),<br />
then when btrfs_mark_bg_unused() is called against the block group, we<br />
assume that the block group is currently in the list of block groups to<br />
reclaim, and we move it out of the list of new block groups and into the<br />
list of unused block groups. This has two consequences:<br />
<br />
1) We move it out of the list of new block groups associated to the<br />
current transaction. So the block group creation is not finished and<br />
if we attempt to delete the bg because it&#39;s unused, we will not find<br />
the block group item in the extent tree (or the new block group tree),<br />
its device extent items in the device tree etc, resulting in the<br />
deletion to fail due to the missing items;<br />
<br />
2) We don&#39;t increment the reference count on the block group when we<br />
move it to the list of unused block groups, because we assumed the<br />
block group was on the list of block groups to reclaim, and in that<br />
case it already has the correct reference count. However the block<br />
group was on the list of new block groups, in which case no extra<br />
reference was taken because it&#39;s local to the current task. This<br />
later results in doing an extra reference count decrement when<br />
removing the block group from the unused list, eventually leading the<br />
reference count to 0.<br />
<br />
This second case was caught when running generic/297 from fstests, which<br />
produced the following assertion failure and stack trace:<br />
<br />
[589.559] assertion failed: refcount_read(&block_group->refs) == 1, in fs/btrfs/block-group.c:4299<br />
[589.559] ------------[ cut here ]------------<br />
[589.559] kernel BUG at fs/btrfs/block-group.c:4299!<br />
[589.560] invalid opcode: 0000 [#1] PREEMPT SMP PTI<br />
[589.560] CPU: 8 PID: 2819134 Comm: umount Tainted: G W 6.4.0-rc6-btrfs-next-134+ #1<br />
[589.560] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014<br />
[589.560] RIP: 0010:btrfs_free_block_groups+0x449/0x4a0 [btrfs]<br />
[589.561] Code: 68 62 da c0 (...)<br />
[589.561] RSP: 0018:ffffa55a8c3b3d98 EFLAGS: 00010246<br />
[589.561] RAX: 0000000000000058 RBX: ffff8f030d7f2000 RCX: 0000000000000000<br />
[589.562] RDX: 0000000000000000 RSI: ffffffff953f0878 RDI: 00000000ffffffff<br />
[589.562] RBP: ffff8f030d7f2088 R08: 0000000000000000 R09: ffffa55a8c3b3c50<br />
[589.562] R10: 0000000000000001 R11: 0000000000000001 R12: ffff8f05850b4c00<br />
[589.562] R13: ffff8f030d7f2090 R14: ffff8f05850b4cd8 R15: dead000000000100<br />
[589.563] FS: 00007f497fd2e840(0000) GS:ffff8f09dfc00000(0000) knlGS:0000000000000000<br />
[589.563] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033<br />
[589.563] CR2: 00007f497ff8ec10 CR3: 0000000271472006 CR4: 0000000000370ee0<br />
[589.563] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000<br />
[589.564] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400<br />
[589.564] Call Trace:<br />
[589.564] <br />
[589.565] ? __die_body+0x1b/0x60<br />
[589.565] ? die+0x39/0x60<br />
[589.565] ? do_trap+0xeb/0x110<br />
[589.565] ? btrfs_free_block_groups+0x449/0x4a0 [btrfs]<br />
[589.566] ? do_error_trap+0x6a/0x90<br />
[589.566] ? btrfs_free_block_groups+0x449/0x4a0 [btrfs]<br />
[589.566] ? exc_invalid_op+0x4e/0x70<br />
[589.566] ? btrfs_free_block_groups+0x449/0x4a0 [btrfs]<br />
[589.567] ? asm_exc_invalid_op+0x16/0x20<br />
[589.567] ? btrfs_free_block_groups+0x449/0x4a0 [btrfs]<br />
[589.567] ? btrfs_free_block_groups+0x449/0x4a0 [btrfs]<br />
[589.567] close_ctree+0x35d/0x560 [btrfs]<br />
[589.568] ? fsnotify_sb_delete+0x13e/0x1d0<br />
[589.568] ? dispose_list+0x3a/0x50<br />
[589.568] ? evict_inodes+0x151/0x1a0<br />
[589.568] generic_shutdown_super+0x73/0x1a0<br />
[589.569] kill_anon_super+0x14/0x30<br />
[589.569] btrfs_kill_super+0x12/0x20 [btrfs]<br />
[589.569] deactivate_locked<br />
---truncated---