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

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2024-56758— btrfs: check folio mapping after unlock in relocate_one_folio()

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存在安全漏洞,该漏洞源于在btrfs文件系统中,relocate_one_folio函数在调用btrfs_read_folio更新folio后解锁folio,此时其他线程可能修改mapping(如通过invalidate移除),导致在后续操作中出现无效页面,若与事务中止并发进行,可能引发内核NULL指针引用错误,进而导致系统崩溃。

AI Predicted 7.8 Difficulty: Moderate EPSS 0.25% · P15

Affected Version Matrix 13

VendorProduct Version RangeStatus
Linux Linux 08daa38ca212d87f77beae839bc9be71079c7abf< 36679fab54fa7bcffafd469e2c474c1fc4beaee0 affected
e7f1326cc24e22b38afc3acd328480a1183f9e79< c7b1bd52a031ad0144d42eef0ba8471ce75122dd affected
e7f1326cc24e22b38afc3acd328480a1183f9e79< d508e56270389b3a16f5b3cf247f4eb1bbad1578 affected
e7f1326cc24e22b38afc3acd328480a1183f9e79< 3e74859ee35edc33a022c3f3971df066ea0ca6b9 affected
9d1e020ed9649cf140fcfafd052cfdcce9e9d67d affected
6.1.54< 6.1.141 affected
6.5.4< 6.6 affected
6.6 affected
… +5 more rows
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2024-56758

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: check folio mapping after unlock in relocate_one_folio()
Source: CVE Program / CVE List V5
Vulnerability Description
In the Linux kernel, the following vulnerability has been resolved: btrfs: check folio mapping after unlock in relocate_one_folio() When we call btrfs_read_folio() to bring a folio uptodate, we unlock the folio. The result of that is that a different thread can modify the mapping (like remove it with invalidate) before we call folio_lock(). This results in an invalid page and we need to try again. In particular, if we are relocating concurrently with aborting a transaction, this can result in a crash like the following: BUG: kernel NULL pointer dereference, address: 0000000000000000 PGD 0 P4D 0 Oops: 0000 [#1] SMP CPU: 76 PID: 1411631 Comm: kworker/u322:5 Workqueue: events_unbound btrfs_reclaim_bgs_work RIP: 0010:set_page_extent_mapped+0x20/0xb0 RSP: 0018:ffffc900516a7be8 EFLAGS: 00010246 RAX: ffffea009e851d08 RBX: ffffea009e0b1880 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffc900516a7b90 RDI: ffffea009e0b1880 RBP: 0000000003573000 R08: 0000000000000001 R09: ffff88c07fd2f3f0 R10: 0000000000000000 R11: 0000194754b575be R12: 0000000003572000 R13: 0000000003572fff R14: 0000000000100cca R15: 0000000005582fff FS: 0000000000000000(0000) GS:ffff88c07fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000407d00f002 CR4: 00000000007706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __die+0x78/0xc0 ? page_fault_oops+0x2a8/0x3a0 ? __switch_to+0x133/0x530 ? wq_worker_running+0xa/0x40 ? exc_page_fault+0x63/0x130 ? asm_exc_page_fault+0x22/0x30 ? set_page_extent_mapped+0x20/0xb0 relocate_file_extent_cluster+0x1a7/0x940 relocate_data_extent+0xaf/0x120 relocate_block_group+0x20f/0x480 btrfs_relocate_block_group+0x152/0x320 btrfs_relocate_chunk+0x3d/0x120 btrfs_reclaim_bgs_work+0x2ae/0x4e0 process_scheduled_works+0x184/0x370 worker_thread+0xc6/0x3e0 ? blk_add_timer+0xb0/0xb0 kthread+0xae/0xe0 ? flush_tlb_kernel_range+0x90/0x90 ret_from_fork+0x2f/0x40 ? flush_tlb_kernel_range+0x90/0x90 ret_from_fork_asm+0x11/0x20 </TASK> This occurs because cleanup_one_transaction() calls destroy_delalloc_inodes() which calls invalidate_inode_pages2() which takes the folio_lock before setting mapping to NULL. We fail to check this, and subsequently call set_extent_mapping(), which assumes that mapping != NULL (in fact it asserts that in debug mode) Note that the "fixes" patch here is not the one that introduced the race (the very first iteration of this code from 2009) but a more recent change that made this particular crash happen in practice.
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存在安全漏洞,该漏洞源于在btrfs文件系统中,relocate_one_folio函数在调用btrfs_read_folio更新folio后解锁folio,此时其他线程可能修改mapping(如通过invalidate移除),导致在后续操作中出现无效页面,若与事务中止并发进行,可能引发内核NULL指针引用错误,进而导致系统崩溃。
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 08daa38ca212d87f77beae839bc9be71079c7abf ~ 36679fab54fa7bcffafd469e2c474c1fc4beaee0 -
Linux Linux 6.6 -

II. Public POCs for CVE-2024-56758

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

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2024-56758

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

Patches & Fixes for CVE-2024-56758 (2)

Same Patch Batch · Linux · 2025-01-06 · 12 CVEs total

CVE-2024-56757 7.8 HIGH Bluetooth: btusb: mediatek: add intf release flow when usb disconnect
CVE-2024-56759 7.8 HIGH btrfs: fix use-after-free when COWing tree bock and tracing is enabled
CVE-2024-56764 7.8 HIGH ublk: detach gendisk from ublk device if add_disk() fails
CVE-2024-56765 7.8 HIGH powerpc/pseries/vas: Add close() callback in vas_vm_ops struct
CVE-2024-56760 PCI/MSI: Handle lack of irqdomain gracefully
CVE-2024-56761 x86/fred: Clear WFE in missing-ENDBRANCH #CPs
CVE-2024-56763 tracing: Prevent bad count for tracing_cpumask_write
CVE-2024-56767 dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
CVE-2024-56766 mtd: rawnand: fix double free in atmel_pmecc_create_user()
CVE-2024-56768 bpf: Fix bpf_get_smp_processor_id() on !CONFIG_SMP
CVE-2024-56769 media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg

IV. Related Vulnerabilities

V. Comments for CVE-2024-56758

No comments yet


Leave a comment