CVE-2024-35784
published 2024-05-17CVE-2024-35784: In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock with fiemap and extent locking While working on the patchset to remove…
PriorityP419medium5.5CVSS 3.1
AVLACLPRLUINSUCNINAH
EPSS
0.17%
7.0th percentile
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix deadlock with fiemap and extent locking
While working on the patchset to remove extent locking I got a lockdep
splat with fiemap and pagefaulting with my new extent lock replacement
lock.
This deadlock exists with our normal code, we just don't have lockdep
annotations with the extent locking so we've never noticed it.
Since we're copying the fiemap extent to user space on every iteration
we have the chance of pagefaulting. Because we hold the extent lock for
the entire range we could mkwrite into a range in the file that we have
mmap'ed. This would deadlock with the following stack trace
[] lock_extent+0x28d/0x2f0
[] btrfs_page_mkwrite+0x273/0x8a0
[] do_page_mkwrite+0x50/0xb0
[] do_fault+0xc1/0x7b0
[] __handle_mm_fault+0x2fa/0x460
[] handle_mm_fault+0xa4/0x330
[] do_user_addr_fault+0x1f4/0x800
[] exc_page_fault+0x7c/0x1e0
[] asm_exc_page_fault+0x26/0x30
[] rep_movs_alternative+0x33/0x70
[] _copy_to_user+0x49/0x70
[] fiemap_fill_next_extent+0xc8/0x120
[] emit_fiemap_extent+0x4d/0xa0
[] extent_fiemap+0x7f8/0xad0
[] btrfs_fiemap+0x49/0x80
[] __x64_sys_ioctl+0x3e1/0xb50
[] do_syscall_64+0x94/0x1a0
[] entry_SYSCALL_64_after_hwframe+0x6e/0x76
I wrote an fstest to reproduce this deadlock without my replacement lock
and verified that the deadlock exists with our existing locking.
To fix this simply don't take the extent lock for the entire duration of
the fiemap. This is safe in general because we keep track of where we
are when we're searching the tree, so if an ordered extent updates in
the middle of our fiemap call we'll still emit the correct extents
because we know what offset we were on before.
The only place we maintain the lock is searching delalloc. Since the
delalloc stuff can change during writeback we want to lock the extent
range so we have a consistent view of delalloc at the time we're
checking to see if we need to set the delalloc flag.
With this patch applied we no long
Affected
13 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| debian | linux | < linux 6.7.12-1 (forky) | linux 6.7.12-1 (forky) |
| linux | linux | — | — |
| linux | linux | >= 1506fcc8189cdd4b95e06df7845a09f18b4526a6 < ded566b4637f1b6b4c9ba74e7d0b8493e93f19cf | ded566b4637f1b6b4c9ba74e7d0b8493e93f19cf |
| linux | linux | >= 1506fcc8189cdd4b95e06df7845a09f18b4526a6 < 89bca7fe6382d61e88c67a0b0e7bce315986fb8b | 89bca7fe6382d61e88c67a0b0e7bce315986fb8b |
| linux | linux | >= 1506fcc8189cdd4b95e06df7845a09f18b4526a6 < b0ad381fa7690244802aed119b478b4bdafc31dd | b0ad381fa7690244802aed119b478b4bdafc31dd |
| linux | linux_kernel | < 6.6.24 | 6.6.24 |
| linux | linux_kernel | — | — |
| linux | linux_kernel | >= 0 < 6.7.12-1 | 6.7.12-1 |
| linux | linux_kernel | >= 0 < 6.7.12-1 | 6.7.12-1 |
| linux | linux_kernel | >= 6.7 < 6.7.12 | 6.7.12 |
| msrc | cbl2_kernel_5.15.186.1-1_on_cbl_mariner_2.0 | — | — |
| msrc | cbl2_kernel_5.15.200.1-1_on_cbl_mariner_2.0 | — | — |
| msrc | cbl2_kernel_5.15.202.1-1_on_cbl_mariner_2.0 | — | — |
CVSS provenance
nvdv3.15.5MEDIUMCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
osv5.5MEDIUM
vendor_debian5.5MEDIUM
vendor_msrc5.5MEDIUM
vendor_redhat5.5MEDIUM
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
Red Hat
kernel: btrfs: fix deadlock with fiemap and extent locking
vendor_redhat·2024-05-17·CVSS 5.5
CVE-2024-35784 [MEDIUM] kernel: btrfs: fix deadlock with fiemap and extent locking
kernel: btrfs: fix deadlock with fiemap and extent locking
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix deadlock with fiemap and extent locking
While working on the patchset to remove extent locking I got a lockdep
splat with fiemap and pagefaulting with my new extent lock replacement
lock.
This deadlock exists with our normal code, we just don't have lockdep
annotations with the extent locking so we've never noticed it.
Since we're copying the fiemap extent to user space on every iteration
we have the chance of pagefaulting. Because we hold the extent lock for
the entire range we could mkwrite into a range in the file that we have
mmap'ed. This would deadlock with the following stack trace
[] lock_extent+0x28d/0x2f0
[] btrfs_page_mkwrite+0x273/0x8a0
[] d
Microsoft
btrfs: fix deadlock with fiemap and extent locking
vendor_msrc·2024-05-14·CVSS 5.5
CVE-2024-35784 [MEDIUM] CWE-667 btrfs: fix deadlock with fiemap and extent locking
btrfs: fix deadlock with fiemap and extent locking
FAQ: Is Azure Linux the only Microsoft product that includes this open-source library and is therefore potentially affected by this vulnerability?
One of the main benefits to our customers who choose to use the Azure Linux distro is the commitment to keep it up to date with the most recent and most secure versions of the open source libraries with which the distro is composed. Microsoft is committed to transparency in this work which is why we began publishing CSAF/VEX in October 2025. See this blog post for more information. If impact to additional products is identified, we will update the CVE to reflect this.
Mariner: Mariner
Linux: Linux
Customer Action Required: Yes
Debian
CVE-2024-35784: linux - In the Linux kernel, the following vulnerability has been resolved: btrfs: fix ...
vendor_debian·2024·CVSS 5.5
CVE-2024-35784 [MEDIUM] CVE-2024-35784: linux - In the Linux kernel, the following vulnerability has been resolved: btrfs: fix ...
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock with fiemap and extent locking While working on the patchset to remove extent locking I got a lockdep splat with fiemap and pagefaulting with my new extent lock replacement lock. This deadlock exists with our normal code, we just don't have lockdep annotations with the extent locking so we've never noticed it. Since we're copying the fiemap extent to user space on every iteration we have the chance of pagefaulting. Because we hold the extent lock for the entire range we could mkwrite into a range in the file that we have mmap'ed. This would deadlock with the following stack trace [] lock_extent+0x28d/0x2f0 [] btrfs_page_mkwrite+0x273/0x8a0 [] do_page_mkwrite+0x50/0xb0 [] do_fault+0xc1/0x7b0 [] __handle_
OSV
CVE-2024-35784: In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock with fiemap and extent locking While working on the patchset t
osv·2024-05-17·CVSS 5.5
CVE-2024-35784 [MEDIUM] CVE-2024-35784: In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock with fiemap and extent locking While working on the patchset t
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock with fiemap and extent locking While working on the patchset to remove extent locking I got a lockdep splat with fiemap and pagefaulting with my new extent lock replacement lock. This deadlock exists with our normal code, we just don't have lockdep annotations with the extent locking so we've never noticed it. Since we're copying the fiemap extent to user space on every iteration we have the chance of pagefaulting. Because we hold the extent lock for the entire range we could mkwrite into a range in the file that we have mmap'ed. This would deadlock with the following stack trace [] lock_extent+0x28d/0x2f0 [] btrfs_page_mkwrite+0x273/0x8a0 [] do_page_mkwrite+0x50/0xb0 [] do_fault+0xc1/0x7b0 [] __handle_
GHSA
GHSA-hg9c-4q92-whw7: In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix deadlock with fiemap and extent locking
While working on the patchset
ghsa_unreviewed·2024-05-17
CVE-2024-35784 [MEDIUM] CWE-667 GHSA-hg9c-4q92-whw7: In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix deadlock with fiemap and extent locking
While working on the patchset
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix deadlock with fiemap and extent locking
While working on the patchset to remove extent locking I got a lockdep
splat with fiemap and pagefaulting with my new extent lock replacement
lock.
This deadlock exists with our normal code, we just don't have lockdep
annotations with the extent locking so we've never noticed it.
Since we're copying the fiemap extent to user space on every iteration
we have the chance of pagefaulting. Because we hold the extent lock for
the entire range we could mkwrite into a range in the file that we have
mmap'ed. This would deadlock with the following stack trace
[] lock_extent+0x28d/0x2f0
[] btrfs_page_mkwrite+0x273/0x8a0
[] do_page_mkwrite+0x50/0xb0
[] do_fault+0xc1/0x7b0
[] __ha
No detection rules found.
No public exploits indexed.
https://git.kernel.org/stable/c/89bca7fe6382d61e88c67a0b0e7bce315986fb8bhttps://git.kernel.org/stable/c/b0ad381fa7690244802aed119b478b4bdafc31ddhttps://git.kernel.org/stable/c/ded566b4637f1b6b4c9ba74e7d0b8493e93f19cfhttps://git.kernel.org/stable/c/89bca7fe6382d61e88c67a0b0e7bce315986fb8bhttps://git.kernel.org/stable/c/b0ad381fa7690244802aed119b478b4bdafc31ddhttps://git.kernel.org/stable/c/ded566b4637f1b6b4c9ba74e7d0b8493e93f19cf
2024-05-17
Published