Vulnerability · Published Jan 15, 2025 · Assigned by Linux

CVE-2024-57884mm: vmscan: account for free pages to prevent infinite Loop in throttle_direct_reclaim()

Medium 5.5

In plain English

A medium-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 12% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS NVD)5.5Medium
Exploit odds (30 days)0.2%top 87.7% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: mm: vmscan: account for free pages to prevent infinite Loop in throttle_direct_reclaim() The task sometimes continues looping in throttle_direct_reclaim() because allow_direct_reclaim(pgdat) keeps returning false. #0 [ffff80002cb6f8d0] __switch_to at ffff8000080095ac #1 [ffff80002cb6f900] __schedule at ffff800008abbd1c #2 [ffff80002cb6f990] schedule at ffff800008abc50c #3 [ffff80002cb6f9b0] throttle_direct_reclaim at ffff800008273550 #4 [ffff80002cb6fa20] try_to_free_pages at ffff800008277b68 #5 [ffff80002cb6fae0] __alloc_pages_nodemask at ffff8000082c4660 #6 [ffff80002cb6fc50] alloc_pages_vma at ffff8000082e4a98 #7 [ffff80002cb6fca0] do_anonymous_page at ffff80000829f5a8 #8 [ffff80002cb6fce0] __handle_mm_fault at ffff8000082a5974 #9 [ffff80002cb6fd90] handle_mm_fault at ffff8000082a5bd4 At this point, the pgdat contains the following two zones: NODE: 4 ZONE: 0 ADDR: ffff00817fffe540 NAME: "DMA32" SIZE: 20480 MIN/LOW/HIGH: 11/28/45 VM_STAT: NR_FREE_PAGES: 359 NR_ZONE_INACTIVE_ANON: 18813 NR_ZONE_ACTIVE_ANON: 0 NR_ZONE_INACTIVE_FILE: 50 NR_ZONE_ACTIVE_FILE: 0 NR_ZONE_UNEVICTABLE: 0 NR_ZONE_WRITE_PENDING: 0 NR_MLOCK: 0 NR_BOUNCE: 0 NR_ZSPAGES: 0 NR_FREE_CMA_PAGES: 0 NODE: 4 ZONE: 1 ADDR: ffff00817fffec00 NAME: "Normal" SIZE: 8454144 PRESENT: 98304 MIN/LOW/HIGH: 68/166/264 VM_STAT: NR_FREE_PAGES: 146 NR_ZONE_INACTIVE_ANON: 94668 NR_ZONE_ACTIVE_ANON: 3 NR_ZONE_INACTIVE_FILE: 735 NR_ZONE_ACTIVE_FILE: 78 NR_ZONE_UNEVICTABLE: 0 NR_ZONE_WRITE_PENDING: 0 NR_MLOCK: 0 NR_BOUNCE: 0 NR_ZSPAGES: 0 NR_FREE_CMA_PAGES: 0 In allow_direct_reclaim(), while processing ZONE_DMA32, the sum of inactive/active file-backed pages calculated in zone_reclaimable_pages() based on the result of zone_page_state_snapshot() is zero. Additionally, since this system lacks swap, the calculation of inactive/ active anonymous pages is skipped. crash> p nr_swap_pages nr_swap_pages = $1937 = { counter = 0 } As a result, ZONE_DMA32 is deemed unreclaimable and skipped, moving on to the processing of the next zone, ZONE_NORMAL, despite ZONE_DMA32 having free pages significantly exceeding the high watermark. The problem is that the pgdat->kswapd_failures hasn't been incremented. crash> px ((struct pglist_data *) 0xffff00817fffe540)->kswapd_failures $1935 = 0x0 This is because the node deemed balanced. The node balancing logic in balance_pgdat() evaluates all zones collectively. If one or more zones (e.g., ZONE_DMA32) have enough free pages to meet their watermarks, the entire node is deemed balanced. This causes balance_pgdat() to exit early before incrementing the kswapd_failures, as it considers the overall memory state acceptable, even though some zones (like ZONE_NORMAL) remain under significant pressure. The patch ensures that zone_reclaimable_pages() includes free pages (NR_FREE_PAGES) in its calculation when no other reclaimable pages are available (e.g., file-backed or anonymous pages). This change prevents zones like ZONE_DMA32, which have sufficient free pages, from being mistakenly deemed unreclaimable. By doing so, the patch ensures proper node balancing, avoids masking pressure on other zones like ZONE_NORMAL, and prevents infinite loops in throttle_direct_reclaim() caused by allow_direct_reclaim(pgdat) repeatedly returning false. The kernel hangs due to a task stuck in throttle_direct_reclaim(), caused by a node being incorrectly deemed balanced despite pressure in certain zones, such as ZONE_NORMAL. This issue arises from zone_reclaimable_pages ---truncated---

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux6.1.124-1DEBIAN-CVE-2024-57884
Debian:13linux6.12.9-1DEBIAN-CVE-2024-57884
Debian:14linux6.12.9-1DEBIAN-CVE-2024-57884
Ubuntu:22.04:LTSlinux5.15.0-135.146UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux6.8.0-60.63UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-aws5.15.0-1080.87UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-aws6.8.0-1029.31UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1029.31~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure5.15.0-1084.93UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-azure6.8.0-1029.34UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-azure-6.116.11.0-1012.12~24.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1029.34~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1084.93.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-azure-nvidia6.8.0-1016.17UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gcp5.15.0-1079.88UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-gcp6.8.0-1030.32UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-gcp-6.116.11.0-1011.11~24.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1030.32~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gke5.15.0-1077.83UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-gke6.8.0-1025.29UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1062.70UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-gkeop6.8.0-1012.14UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-hwe-6.116.11.0-21.21~24.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-60.63~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-ibm5.15.0-1072.75UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-ibm6.8.0-1026.26UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-ibm-6.86.8.0-1026.26~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-intel-iot-realtime5.15.0-1073.75UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1075.81UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-kvm5.15.0-1076.81UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-135.146UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-60.63.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-60.63.1~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1074.75UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1028.31UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-nvidia-6.116.11.0-1007.7UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1028.31~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1028.31.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-nvidia-tegra5.15.0-1033.33UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-nvidia-tegra6.8.0-1008.8UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-nvidia-tegra-igx5.15.0-1021.21UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-oem-6.116.11.0-1017.17UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1028.28UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oracle5.15.0-1077.83UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-oracle6.8.0-1026.27UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1026.27~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-raspi5.15.0-1074.77UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-raspi6.8.0-1028.32UBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-raspi-realtimeno fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-riscv6.8.0-60.63.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-riscv-6.86.8.0-62.65~22.04.1UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-57884
Ubuntu:24.04:LTSlinux-xilinx6.8.0-1017.18UBUNTU-CVE-2024-57884
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1044.48UBUNTU-CVE-2024-57884

Affected products (as reported)

VendorProductVersions
Linux Linux 5a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before 66cd37660ec34ec444fe42f2277330ae4a36bb195a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before d675fefbaec3815b3ae0af1bebd97f27df3a05c85a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before 63eac98d6f0898229f515cb62fe4e4db2430e99c5a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before bfb701192129803191c9cd6cdd1f82cd07f8de2c5a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before 1ff2302e8aeac7f2eedb551d7a89617283b5c6b25a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before 58d0d02dbc67438fc80223fdd7bbc49cf07332845a1c84b404a7176b8b36e2a0041b6f0adb3151a3 – before 6aaced5abd32e2a57cd94fd64f824514d0361da8
Linux Linux 4.8

References