CVE-2024-26960

Aliases:UBUNTU-CVE-2024-26960DEBIAN-CVE-2024-26960
Advisory lineage Upstream: 0 Downstream: 36
Modified
Published: 01 May 2024, 05:19
Last modified:05 Aug 2026, 11:28

Vulnerability Summary

Overall Risk (default)
medium
28/100
CVSS Score
7 HIGH
v3.1 (cve.org)
EPSS Score
0.18% LOW
0% probability +0.17%
KEV
Not listed
Ransomware
No reports
Public exploits
None found
Dark Web
Not detected

Timeline

01 May 2024, 05:19
Published
Vulnerability first disclosed
05 Aug 2026, 11:28
Last Modified
Vulnerability information updated

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

CVSS Metrics

  • v3.1HIGHScore: 7CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

EPSS Trends

Current EPSS score: 0.18% Percentile: 8%

Techniques & Countermeasures

  • CWE-362Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

    The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.

Affected Systems

  • debianlinux

    < 5.10.216-1 | < 6.1.85-1 | < 6.7.12-1 | < 6.7.12-1

  • ubuntulinux

    < 4.15.0-230.242 | < 5.4.0-198.218 | < 5.15.0-116.126 | < 6.8.0-35.35

  • ubuntulinux-allwinner-5.19

    all

  • ubuntulinux-aws

    < 4.15.0-1174.187 | < 5.4.0-1134.144 | < 5.15.0-1065.71 | < 6.8.0-1009.9

  • ubuntulinux-aws-5.0

    all

  • ubuntulinux-aws-5.11

    all

  • ubuntulinux-aws-5.13

    all

  • ubuntulinux-aws-5.15

    < 5.15.0-1065.71~20.04.1

  • ubuntulinux-aws-5.19

    all

  • ubuntulinux-aws-5.3

    all

  • ubuntulinux-aws-5.4

    < 5.4.0-1134.144~18.04.1

  • ubuntulinux-aws-5.8

    all

  • ubuntulinux-aws-6.2

    all

  • ubuntulinux-aws-6.5

    all

  • ubuntulinux-aws-fips

    < 4.15.0-2112.118 | all | < 5.4.0-1134.144+fips1 | < 5.15.0-1065.71+fips1

  • ubuntulinux-aws-hwe

    < 4.15.0-1174.187~16.04.1

  • ubuntulinux-azure

    < 4.15.0-1182.197~14.04.1 | < 4.15.0-1182.197~16.04.1 | all | < 5.4.0-1139.146 | < 5.15.0-1068.77 | < 6.8.0-1008.8

  • ubuntulinux-azure-4.15

    < 4.15.0-1182.197

  • ubuntulinux-azure-5.11

    all

  • ubuntulinux-azure-5.13

    all

  • ubuntulinux-azure-5.15

    < 5.15.0-1068.77~20.04.1

  • ubuntulinux-azure-5.19

    all

  • ubuntulinux-azure-5.3

    all

  • ubuntulinux-azure-5.4

    < 5.4.0-1139.146~18.04.1

  • ubuntulinux-azure-5.8

    all

  • ubuntulinux-azure-6.2

    all

  • ubuntulinux-azure-6.5

    all

  • ubuntulinux-azure-edge

    all

  • ubuntulinux-azure-fde

    all | < 5.15.0-1068.77.1

  • ubuntulinux-azure-fde-5.19

    all

  • ubuntulinux-azure-fde-6.2

    all

  • ubuntulinux-azure-fips

    < 4.15.0-2091.97 | all | < 5.4.0-1139.146+fips1 | < 5.15.0-1068.77+fips1

  • ubuntulinux-bluefield

    all | < 5.4.0-1094.101 | < 5.15.0-1047.49

  • ubuntulinux-fips

    < 4.15.0-1128.139 | all | < 5.4.0-1108.118 | < 5.15.0-115.125+fips1

  • ubuntulinux-gcp

    < 4.15.0-1167.184~16.04.2 | all | < 5.4.0-1138.147 | < 5.15.0-1064.72 | < 6.8.0-1008.9

  • ubuntulinux-gcp-4.15

    < 4.15.0-1167.184

  • ubuntulinux-gcp-5.11

    all

  • ubuntulinux-gcp-5.13

    all

  • ubuntulinux-gcp-5.15

    < 5.15.0-1065.73~20.04.1

  • ubuntulinux-gcp-5.19

    all

  • ubuntulinux-gcp-5.3

    all

  • ubuntulinux-gcp-5.4

    < 5.4.0-1138.147~18.04.1

  • ubuntulinux-gcp-5.8

    all

  • ubuntulinux-gcp-6.2

    all

  • ubuntulinux-gcp-6.5

    all

  • ubuntulinux-gcp-fips

    < 4.15.0-2075.80 | all | < 5.4.0-1138.147+fips1 | < 5.15.0-1064.72+fips1

  • ubuntulinux-gke

    all | < 5.15.0-1062.68 | < 6.8.0-1004.7

  • ubuntulinux-gke-4.15

    all

  • ubuntulinux-gke-5.15

    all

  • ubuntulinux-gke-5.4

    all

Showing first 50 affected entries in server-rendered view.

References (31)