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

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2024-26960— mm: swap: fix race between free_swap_and_cache() and swapoff()

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存在安全漏洞,该漏洞源于free_swap_and_cache函数和swapoff函数之间存在竞争。

CVSS 7.0 · High EPSS 0.18% · P7

Affected Version Matrix 16

VendorProduct Version RangeStatus
Linux Linux 7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< d85c11c97ecf92d47a4b29e3faca714dc1f18d0d affected
7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< 2da5568ee222ce0541bfe446a07998f92ed1643e affected
7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< 1ede7f1d7eed1738d1b9333fd1e152ccb450b86a affected
7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< 0f98f6d2fb5fad00f8299b84b85b6bc1b6d7d19a affected
7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< 3ce4c4c653e4e478ecb15d3c88e690f12cbf6b39 affected
7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< 363d17e7f7907c8e27a9e86968af0eaa2301787b affected
7c00bafee87c7bac7ed9eced7c161f8e5332cb4e< 82b1c07a0af603e3c47b906c8e991dc96f01688e affected
4.11 affected
… +8 more rows
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2024-26960

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
mm: swap: fix race between free_swap_and_cache() and swapoff()
Source: CVE Program / CVE List V5
Vulnerability Description
In the Linux kernel, the following vulnerability has been resolved: mm: swap: fix race between free_swap_and_cache() and swapoff() There was previously a theoretical window where swapoff() could run and teardown a swap_info_struct while a call to free_swap_and_cache() was running in another thread. This could cause, amongst other bad possibilities, swap_page_trans_huge_swapped() (called by free_swap_and_cache()) to access the freed memory for swap_map. This is a theoretical problem and I haven't been able to provoke it from a test case. But there has been agreement based on code review that this is possible (see link below). Fix it by using get_swap_device()/put_swap_device(), which will stall swapoff(). There was an extra check in _swap_info_get() to confirm that the swap entry was not free. This isn't present in get_swap_device() because it doesn't make sense in general due to the race between getting the reference and swapoff. So I've added an equivalent check directly in free_swap_and_cache(). Details of how to provoke one possible issue (thanks to David Hildenbrand for deriving this): --8<----- __swap_entry_free() might be the last user and result in "count == SWAP_HAS_CACHE". swapoff->try_to_unuse() will stop as soon as soon as si->inuse_pages==0. So the question is: could someone reclaim the folio and turn si->inuse_pages==0, before we completed swap_page_trans_huge_swapped(). Imagine the following: 2 MiB folio in the swapcache. Only 2 subpages are still references by swap entries. Process 1 still references subpage 0 via swap entry. Process 2 still references subpage 1 via swap entry. Process 1 quits. Calls free_swap_and_cache(). -> count == SWAP_HAS_CACHE [then, preempted in the hypervisor etc.] Process 2 quits. Calls free_swap_and_cache(). -> count == SWAP_HAS_CACHE Process 2 goes ahead, passes swap_page_trans_huge_swapped(), and calls __try_to_reclaim_swap(). __try_to_reclaim_swap()->folio_free_swap()->delete_from_swap_cache()-> put_swap_folio()->free_swap_slot()->swapcache_free_entries()-> swap_entry_free()->swap_range_free()-> ... WRITE_ONCE(si->inuse_pages, si->inuse_pages - nr_entries); What stops swapoff to succeed after process 2 reclaimed the swap cache but before process1 finished its call to swap_page_trans_huge_swapped()? --8<-----
Source: CVE Program / CVE List V5
CVSS Information
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
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存在安全漏洞,该漏洞源于free_swap_and_cache函数和swapoff函数之间存在竞争。
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 7c00bafee87c7bac7ed9eced7c161f8e5332cb4e ~ d85c11c97ecf92d47a4b29e3faca714dc1f18d0d -
Linux Linux 4.11 -

II. Public POCs for CVE-2024-26960

# 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-26960

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

Mailing List Discussions for CVE-2024-26960 (1)

Other References for CVE-2024-26960 (7)

Same Patch Batch · Linux · 2024-05-01 · 159 CVEs total

CVE-2024-27388 9.8 CRITICAL SUNRPC: fix some memleaks in gssx_dec_option_array
CVE-2024-26953 9.8 CRITICAL net: esp: fix bad handling of pages from page_pool
CVE-2024-26931 8.8 HIGH scsi: qla2xxx: Fix command flush on cable pull
CVE-2024-27053 8.8 HIGH wifi: wilc1000: fix RCU usage in connect path
CVE-2024-26990 8.8 HIGH KVM: x86/mmu: Write-protect L2 SPTEs in TDP MMU when clearing dirty status
CVE-2024-26952 8.3 HIGH ksmbd: fix potencial out-of-bounds when buffer offset is invalid
CVE-2024-27018 8.2 HIGH netfilter: br_netfilter: skip conntrack input hook for promisc packets
CVE-2024-26936 8.2 HIGH ksmbd: validate request buffer size in smb2_allocate_rsp_buf()
CVE-2024-26980 8.2 HIGH ksmbd: fix slab-out-of-bounds in smb2_allocate_rsp_buf
CVE-2024-26954 8.1 HIGH ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()
CVE-2024-26994 7.8 HIGH speakup: Avoid crash on very long word
CVE-2024-26966 7.8 HIGH clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays
CVE-2024-26974 7.8 HIGH crypto: qat - resolve race condition during AER recovery
CVE-2024-26976 7.8 HIGH KVM: Always flush async #PF workqueue when vCPU is being destroyed
CVE-2024-27062 7.8 HIGH nouveau: lock the client object tree.
CVE-2024-27061 7.8 HIGH crypto: sun8i-ce - Fix use after free in unprepare
CVE-2024-26983 7.8 HIGH bootconfig: use memblock_free_late to free xbc memory to buddy
CVE-2024-27058 7.8 HIGH tmpfs: fix race on handling dquot rbtree
CVE-2024-27056 7.8 HIGH wifi: iwlwifi: mvm: ensure offloading TID queue exists
CVE-2024-27017 7.8 HIGH netfilter: nft_set_pipapo: walk over current view on netlink dump

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

IV. Related Vulnerabilities

V. Comments for CVE-2024-26960

No comments yet


Leave a comment