Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2021-46987— btrfs: fix deadlock when cloning inline extents and using qgroups

Quick assessment

Affected
Linux Linux
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于在使用 qgroup 时会出现死锁情况。

AI Predicted 4.7 Difficulty: Moderate EPSS 0.18% · P7

Possible ATT&CK Techniques 1 AI

T1499 · Endpoint Denial of Service

Affected Version Matrix 12

VendorProduct Version RangeStatus
Linux Linux c53e9653605dbf708f5be02902de51831be4b009< f8fbbd06fab9b75dcd68d850fe318ac3bc128974 affected
c53e9653605dbf708f5be02902de51831be4b009< d5347827d0b4b2250cbce6eccaa1c81dc78d8651 affected
c53e9653605dbf708f5be02902de51831be4b009< 96157707c0420e3d3edfe046f1cc797fee117ade affected
c53e9653605dbf708f5be02902de51831be4b009< f9baa501b4fd6962257853d46ddffbc21f27e344 affected
36af2de520cca7c37974cc4944b47850f6c460ee affected
5.4.141< 5.5 affected
5.9 affected
< 5.9 unaffected
… +4 more rows
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2021-46987

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
btrfs: fix deadlock when cloning inline extents and using qgroups
Source: CVE Program / CVE List V5
Vulnerability Description
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock when cloning inline extents and using qgroups There are a few exceptional cases where cloning an inline extent needs to copy the inline extent data into a page of the destination inode. When this happens, we end up starting a transaction while having a dirty page for the destination inode and while having the range locked in the destination's inode iotree too. Because when reserving metadata space for a transaction we may need to flush existing delalloc in case there is not enough free space, we have a mechanism in place to prevent a deadlock, which was introduced in commit 3d45f221ce627d ("btrfs: fix deadlock when cloning inline extent and low on free metadata space"). However when using qgroups, a transaction also reserves metadata qgroup space, which can also result in flushing delalloc in case there is not enough available space at the moment. When this happens we deadlock, since flushing delalloc requires locking the file range in the inode's iotree and the range was already locked at the very beginning of the clone operation, before attempting to start the transaction. When this issue happens, stack traces like the following are reported: [72747.556262] task:kworker/u81:9 state:D stack: 0 pid: 225 ppid: 2 flags:0x00004000 [72747.556268] Workqueue: writeback wb_workfn (flush-btrfs-1142) [72747.556271] Call Trace: [72747.556273] __schedule+0x296/0x760 [72747.556277] schedule+0x3c/0xa0 [72747.556279] io_schedule+0x12/0x40 [72747.556284] __lock_page+0x13c/0x280 [72747.556287] ? generic_file_readonly_mmap+0x70/0x70 [72747.556325] extent_write_cache_pages+0x22a/0x440 [btrfs] [72747.556331] ? __set_page_dirty_nobuffers+0xe7/0x160 [72747.556358] ? set_extent_buffer_dirty+0x5e/0x80 [btrfs] [72747.556362] ? update_group_capacity+0x25/0x210 [72747.556366] ? cpumask_next_and+0x1a/0x20 [72747.556391] extent_writepages+0x44/0xa0 [btrfs] [72747.556394] do_writepages+0x41/0xd0 [72747.556398] __writeback_single_inode+0x39/0x2a0 [72747.556403] writeback_sb_inodes+0x1ea/0x440 [72747.556407] __writeback_inodes_wb+0x5f/0xc0 [72747.556410] wb_writeback+0x235/0x2b0 [72747.556414] ? get_nr_inodes+0x35/0x50 [72747.556417] wb_workfn+0x354/0x490 [72747.556420] ? newidle_balance+0x2c5/0x3e0 [72747.556424] process_one_work+0x1aa/0x340 [72747.556426] worker_thread+0x30/0x390 [72747.556429] ? create_worker+0x1a0/0x1a0 [72747.556432] kthread+0x116/0x130 [72747.556435] ? kthread_park+0x80/0x80 [72747.556438] ret_from_fork+0x1f/0x30 [72747.566958] Workqueue: btrfs-flush_delalloc btrfs_work_helper [btrfs] [72747.566961] Call Trace: [72747.566964] __schedule+0x296/0x760 [72747.566968] ? finish_wait+0x80/0x80 [72747.566970] schedule+0x3c/0xa0 [72747.566995] wait_extent_bit.constprop.68+0x13b/0x1c0 [btrfs] [72747.566999] ? finish_wait+0x80/0x80 [72747.567024] lock_extent_bits+0x37/0x90 [btrfs] [72747.567047] btrfs_invalidatepage+0x299/0x2c0 [btrfs] [72747.567051] ? find_get_pages_range_tag+0x2cd/0x380 [72747.567076] __extent_writepage+0x203/0x320 [btrfs] [72747.567102] extent_write_cache_pages+0x2bb/0x440 [btrfs] [72747.567106] ? update_load_avg+0x7e/0x5f0 [72747.567109] ? enqueue_entity+0xf4/0x6f0 [72747.567134] extent_writepages+0x44/0xa0 [btrfs] [72747.567137] ? enqueue_task_fair+0x93/0x6f0 [72747.567140] do_writepages+0x41/0xd0 [72747.567144] __filemap_fdatawrite_range+0xc7/0x100 [72747.567167] btrfs_run_delalloc_work+0x17/0x40 [btrfs] [72747.567195] btrfs_work_helper+0xc2/0x300 [btrfs] [72747.567200] process_one_work+0x1aa/0x340 [72747.567202] worker_thread+0x30/0x390 [72747.567205] ? create_worker+0x1a0/0x1a0 [72747.567208] kthread+0x116/0x130 [72747.567211] ? kthread_park+0x80/0x80 [72747.567214] ret_from_fork+0x1f/0x30 [72747.569686] task:fsstress state:D stack: ---truncated---
Source: CVE Program / CVE List V5
CVSS Information
N/A
Source: CVE Program / CVE List V5
Vulnerability Type
N/A
Source: CVE Program / CVE List V5
Vulnerability Title
Linux kernel 安全漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于在使用 qgroup 时会出现死锁情况。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
Linux Linux c53e9653605dbf708f5be02902de51831be4b009 ~ f8fbbd06fab9b75dcd68d850fe318ac3bc128974 -
Linux Linux 5.9 -

II. Public POCs for CVE-2021-46987

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2021-46987

请登录查看更多情报信息。

Other References for CVE-2021-46987 (3)

Same Patch Batch · Linux · 2024-02-28 · 86 CVEs total

CVE-2021-47013 9.8 CRITICAL net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
CVE-2021-47036 9.8 CRITICAL udp: skip L4 aggregation for UDP tunnel packets
CVE-2021-46999 9.8 CRITICAL sctp: do asoc update earlier in sctp_sf_do_dupcook_a
CVE-2021-47035 8.8 HIGH iommu/vt-d: Remove WO permissions on second-level paging entries
CVE-2021-47017 8.8 HIGH ath10k: Fix a use after free in ath10k_htc_send_bundle
CVE-2021-47049 8.4 HIGH Drivers: hv: vmbus: Use after free in __vmbus_open()
CVE-2021-47014 7.8 HIGH net/sched: act_ct: fix wild memory access when clearing fragments
CVE-2020-36785 7.8 HIGH media: atomisp: Fix use after free in atomisp_alloc_css_stat_bufs()
CVE-2021-47040 7.8 HIGH io_uring: fix overflows checks in provide buffers
CVE-2021-47048 7.8 HIGH spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op
CVE-2021-46984 7.8 HIGH kyber: fix out of bounds access when preempted
CVE-2021-46993 7.8 HIGH sched: Fix out-of-bound access in uclamp
CVE-2021-46998 7.8 HIGH ethernet:enic: Fix a use after free bug in enic_hard_start_xmit
CVE-2021-46992 7.8 HIGH netfilter: nftables: avoid overflows in nft_hash_buckets()
CVE-2021-46977 7.8 HIGH KVM: VMX: Disable preemption when probing user return MSRs
CVE-2021-47012 7.8 HIGH RDMA/siw: Fix a use after free in siw_alloc_mr
CVE-2021-47011 7.8 HIGH mm: memcontrol: slab: fix obtain a reference to a freeing memcg
CVE-2020-36787 7.8 HIGH media: aspeed: fix clock handling logic
CVE-2021-47041 7.5 HIGH nvmet-tcp: fix incorrect locking in state_change sk callback
CVE-2021-46983 7.5 HIGH nvmet-rdma: Fix NULL deref when SEND is completed with error

Showing top 20 of 86 CVEs. View all on vendor page &rarr; →

IV. Related Vulnerabilities

V. Comments for CVE-2021-46987

No comments yet


Leave a comment