Lucene search

K
cvelistLinuxCVELIST:CVE-2024-42316
HistoryAug 17, 2024 - 9:09 a.m.

CVE-2024-42316 mm/mglru: fix div-by-zero in vmpressure_calc_level()

2024-08-1709:09:24
Linux
www.cve.org
2
linux kernel
vulnerability
div-by-zero
vmpressure_calc_level
evict_folios
page writeback
folio_rotate_reclaimable
underflow
shrink_folio_list

EPSS

0

Percentile

5.0%

In the Linux kernel, the following vulnerability has been resolved:

mm/mglru: fix div-by-zero in vmpressure_calc_level()

evict_folios() uses a second pass to reclaim folios that have gone through
page writeback and become clean before it finishes the first pass, since
folio_rotate_reclaimable() cannot handle those folios due to the
isolation.

The second pass tries to avoid potential double counting by deducting
scan_control->nr_scanned. However, this can result in underflow of
nr_scanned, under a condition where shrink_folio_list() does not increment
nr_scanned, i.e., when folio_trylock() fails.

The underflow can cause the divisor, i.e., scale=scanned+reclaimed in
vmpressure_calc_level(), to become zero, resulting in the following crash:

[exception RIP: vmpressure_work_fn+101]
process_one_work at ffffffffa3313f2b

Since scan_control->nr_scanned has no established semantics, the potential
double counting has minimal risks. Therefore, fix the problem by not
deducting scan_control->nr_scanned in evict_folios().

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "mm/vmscan.c"
    ],
    "versions": [
      {
        "version": "359a5e1416ca",
        "lessThan": "8de7bf77f210",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "359a5e1416ca",
        "lessThan": "d6510f234c7d",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "359a5e1416ca",
        "lessThan": "a39e38be632f",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "359a5e1416ca",
        "lessThan": "8b671fe1a879",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "mm/vmscan.c"
    ],
    "versions": [
      {
        "version": "6.1",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "6.1",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.1.103",
        "lessThanOrEqual": "6.1.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.6.44",
        "lessThanOrEqual": "6.6.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.10.3",
        "lessThanOrEqual": "6.10.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.11",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

EPSS

0

Percentile

5.0%