CVE-2024-50263 (GCVE-0-2024-50263)
Vulnerability from cvelistv5
Published
2024-11-11 13:58
Modified
2026-08-05 11:42
Summary
In the Linux kernel, the following vulnerability has been resolved: fork: only invoke khugepaged, ksm hooks if no error There is no reason to invoke these hooks early against an mm that is in an incomplete state. The change in commit d24062914837 ("fork: use __mt_dup() to duplicate maple tree in dup_mmap()") makes this more pertinent as we may be in a state where entries in the maple tree are not yet consistent. Their placement early in dup_mmap() only appears to have been meaningful for early error checking, and since functionally it'd require a very small allocation to fail (in practice 'too small to fail') that'd only occur in the most dire circumstances, meaning the fork would fail or be OOM'd in any case. Since both khugepaged and KSM tracking are there to provide optimisations to memory performance rather than critical functionality, it doesn't really matter all that much if, under such dire memory pressure, we fail to register an mm with these. As a result, we follow the example of commit d2081b2bf819 ("mm: khugepaged: make khugepaged_enter() void function") and make ksm_fork() a void function also. We only expose the mm to these functions once we are done with them and only if no error occurred in the fork operation.
Impacted products
Vendor Product Version
Linux Linux Version: d2406291483775ecddaee929231a39c70c08fda2
Version: d2406291483775ecddaee929231a39c70c08fda2
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "include/linux/ksm.h",
            "kernel/fork.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "3b85aa0da8cd01173b9afd1f70080fbb9576c4b0",
              "status": "affected",
              "version": "d2406291483775ecddaee929231a39c70c08fda2",
              "versionType": "git"
            },
            {
              "lessThan": "985da552a98e27096444508ce5d853244019111f",
              "status": "affected",
              "version": "d2406291483775ecddaee929231a39c70c08fda2",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "include/linux/ksm.h",
            "kernel/fork.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.8"
            },
            {
              "lessThan": "6.8",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.11.*",
              "status": "unaffected",
              "version": "6.11.7",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.12",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.11.7",
                  "versionStartIncluding": "6.8",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.12",
                  "versionStartIncluding": "6.8",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nfork: only invoke khugepaged, ksm hooks if no error\n\nThere is no reason to invoke these hooks early against an mm that is in an\nincomplete state.\n\nThe change in commit d24062914837 (\"fork: use __mt_dup() to duplicate\nmaple tree in dup_mmap()\") makes this more pertinent as we may be in a\nstate where entries in the maple tree are not yet consistent.\n\nTheir placement early in dup_mmap() only appears to have been meaningful\nfor early error checking, and since functionally it\u0027d require a very small\nallocation to fail (in practice \u0027too small to fail\u0027) that\u0027d only occur in\nthe most dire circumstances, meaning the fork would fail or be OOM\u0027d in\nany case.\n\nSince both khugepaged and KSM tracking are there to provide optimisations\nto memory performance rather than critical functionality, it doesn\u0027t\nreally matter all that much if, under such dire memory pressure, we fail\nto register an mm with these.\n\nAs a result, we follow the example of commit d2081b2bf819 (\"mm:\nkhugepaged: make khugepaged_enter() void function\") and make ksm_fork() a\nvoid function also.\n\nWe only expose the mm to these functions once we are done with them and\nonly if no error occurred in the fork operation."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "baseScore": 7.8,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
            "version": "3.1"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "AV:L - The vulnerability is reached through ordinary local syscalls \u2014 `madvise(MADV_HUGEPAGE)`/`MADV_MERGEABLE` to register the mm with khugepaged/KSM, then `fork()`/`clone()` forced down an error path in `dup_mmap()`. No network or remote input is involved.\nAC:L - The attacker controls both sides of the race: they choose when the child mm is added to the khugepaged/KSM lists, they deterministically force the `dup_mmap()` error (e.g. SIGKILL landing in the VMA loop via `fatal_signal_pending(current)`, or ENOMEM under a self-imposed memcg limit), and KSM\u0027s blocking `mmap_read_lock(mm)` means ksmd is handed the lock the moment `dup_mmap()` unlocks. The attempt can be repeated indefinitely at no cost.\nPR:L - Only an unprivileged local user account is needed \u2014 `fork()`, `madvise()` and `prctl(PR_SET_MEMORY_MERGE)` require no capabilities, and no namespace tricks are necessary.\nUI:N - The attacker\u0027s own process performs the fork and the error injection; khugepaged/ksmd are always-running kernel threads. No victim action is required.\nS:U - The corruption is confined to kernel memory management structures within the same security authority; there is no VM, IOMMU or sandbox boundary crossed.\nC:H - khugepaged/KSM walk the child\u0027s maple tree containing the parent\u0027s VMAs and, once the parent unmaps them, freed `vm_area_struct`s \u2014 a use-after-free read of attacker-groomable heap memory, plus cross-address-space page/rmap confusion that can expose another address space\u0027s page contents.\nI:H - The scanners act on stale/foreign VMAs while installing PMDs and rewriting PTEs and rmap in the wrong mm (`collapse_file()`, `collapse_pte_mapped_thp()`, KSM\u0027s `try_to_merge_one_page()` with `vma-\u003evm_mm != mm`), and dereference `vm_ops`/`anon_vma`/`vm_file` from freed objects \u2014 a UAF/type-confusion primitive usable for arbitrary write and control-flow hijack.\nA:H - At minimum the walkers dereference `XA_ZERO_ENTRY` (0x406) as a `struct vm_area_struct *`, producing a NULL-page kernel oops in khugepaged/ksmd; the use-after-free on parent VMAs likewise causes kernel crashes and, with `panic_on_oops`, a full panic."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T11:42:52.945Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/3b85aa0da8cd01173b9afd1f70080fbb9576c4b0"
        },
        {
          "url": "https://git.kernel.org/stable/c/985da552a98e27096444508ce5d853244019111f"
        },
        {
          "url": "https://project-zero.issues.chromium.org/issues/373391951"
        }
      ],
      "title": "fork: only invoke khugepaged, ksm hooks if no error",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2024-50263",
    "datePublished": "2024-11-11T13:58:18.577Z",
    "dateReserved": "2024-10-21T19:36:19.982Z",
    "dateUpdated": "2026-08-05T11:42:52.945Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…