In the Linux kernel, the following vulnerability has been resolved: btrfs:
fix race between ordered extent completion and fiemap For fiemap we
recently stopped locking the target extent range for the whole duration of
the fiemap call, in order to avoid a deadlock in a scenario where the
fiemap buffer happens to be a memory mapped range of the same file. This
use case is very unlikely to be useful in practice but it may be triggered
by fuzz testing (syzbot, etc). However by not locking the target extent
range for the whole duration of the fiemap call we can race with an ordered
extent. This happens like this: 1) The fiemap task finishes processing a
file extent item that covers the file range [512K, 1M[, and that file
extent item is the last item in the leaf currently being processed; 2) And
ordered extent for the file range [768K, 2M[, in COW mode, completes
(btrfs_finish_one_ordered()) and the file extent item covering the range
[512K, 1M[ is trimmed to cover the range [512K, 768K[ and then a new file
extent item for the range [768K, 2M[ is inserted in the inode’s subvolume
tree; 3) The fiemap task calls fiemap_next_leaf_item(), which then calls
btrfs_next_leaf() to find the next leaf / item. This finds that the the
next key following the one we previously processed (its type is
BTRFS_EXTENT_DATA_KEY and its offset is 512K), is the key corresponding to
the new file extent item inserted by the ordered extent, which has a type
of BTRFS_EXTENT_DATA_KEY and an offset of 768K; 4) Later the fiemap code
ends up at emit_fiemap_extent() and triggers the warning: if (cache->offset
OS | Version | Architecture | Package | Version | Filename |
---|---|---|---|---|---|
ubuntu | 18.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 20.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 22.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 23.10 | noarch | linux | < any | UNKNOWN |
ubuntu | 24.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 14.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 16.04 | noarch | linux | < any | UNKNOWN |
ubuntu | 18.04 | noarch | linux-aws | < any | UNKNOWN |
ubuntu | 20.04 | noarch | linux-aws | < any | UNKNOWN |
ubuntu | 22.04 | noarch | linux-aws | < any | UNKNOWN |