CVE-2023-53178 (GCVE-0-2023-53178)
Vulnerability from cvelistv5
Published
2025-09-15 14:04
Modified
2026-08-05 09:12
Summary
In the Linux kernel, the following vulnerability has been resolved: mm: fix zswap writeback race condition The zswap writeback mechanism can cause a race condition resulting in memory corruption, where a swapped out page gets swapped in with data that was written to a different page. The race unfolds like this: 1. a page with data A and swap offset X is stored in zswap 2. page A is removed off the LRU by zpool driver for writeback in zswap-shrink work, data for A is mapped by zpool driver 3. user space program faults and invalidates page entry A, offset X is considered free 4. kswapd stores page B at offset X in zswap (zswap could also be full, if so, page B would then be IOed to X, then skip step 5.) 5. entry A is replaced by B in tree->rbroot, this doesn't affect the local reference held by zswap-shrink work 6. zswap-shrink work writes back A at X, and frees zswap entry A 7. swapin of slot X brings A in memory instead of B The fix: Once the swap page cache has been allocated (case ZSWAP_SWAPCACHE_NEW), zswap-shrink work just checks that the local zswap_entry reference is still the same as the one in the tree. If it's not the same it means that it's either been invalidated or replaced, in both cases the writeback is aborted because the local entry contains stale data. Reproducer: I originally found this by running `stress` overnight to validate my work on the zswap writeback mechanism, it manifested after hours on my test machine. The key to make it happen is having zswap writebacks, so whatever setup pumps /sys/kernel/debug/zswap/written_back_pages should do the trick. In order to reproduce this faster on a vm, I setup a system with ~100M of available memory and a 500M swap file, then running `stress --vm 1 --vm-bytes 300000000 --vm-stride 4000` makes it happen in matter of tens of minutes. One can speed things up even more by swinging /sys/module/zswap/parameters/max_pool_percent up and down between, say, 20 and 1; this makes it reproduce in tens of seconds. It's crucial to set `--vm-stride` to something other than 4096 otherwise `stress` won't realize that memory has been corrupted because all pages would have the same data.
Impacted products
Vendor Product Version
Linux Linux Version: 2b2811178e85553405b86e3fe78357b9b95889ce
Version: 2b2811178e85553405b86e3fe78357b9b95889ce
Version: 2b2811178e85553405b86e3fe78357b9b95889ce
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2023-53178",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2026-06-10T20:42:26.000674Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2026-06-11T18:44:23.133Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "mm/zswap.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "2cab13f500a6333bd2b853783ac76be9e4956f8a",
              "status": "affected",
              "version": "2b2811178e85553405b86e3fe78357b9b95889ce",
              "versionType": "git"
            },
            {
              "lessThan": "ba700ea13bf0105a4773c654f7d3bef8adb64ab2",
              "status": "affected",
              "version": "2b2811178e85553405b86e3fe78357b9b95889ce",
              "versionType": "git"
            },
            {
              "lessThan": "04fc7816089c5a32c29a04ec94b998e219dfb946",
              "status": "affected",
              "version": "2b2811178e85553405b86e3fe78357b9b95889ce",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "mm/zswap.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "3.11"
            },
            {
              "lessThan": "3.11",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.30",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.3.*",
              "status": "unaffected",
              "version": "6.3.4",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.4",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.30",
                  "versionStartIncluding": "3.11",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.3.4",
                  "versionStartIncluding": "3.11",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.4",
                  "versionStartIncluding": "3.11",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmm: fix zswap writeback race condition\n\nThe zswap writeback mechanism can cause a race condition resulting in\nmemory corruption, where a swapped out page gets swapped in with data that\nwas written to a different page.\n\nThe race unfolds like this:\n1. a page with data A and swap offset X is stored in zswap\n2. page A is removed off the LRU by zpool driver for writeback in\n   zswap-shrink work, data for A is mapped by zpool driver\n3. user space program faults and invalidates page entry A, offset X is\n   considered free\n4. kswapd stores page B at offset X in zswap (zswap could also be\n   full, if so, page B would then be IOed to X, then skip step 5.)\n5. entry A is replaced by B in tree-\u003erbroot, this doesn\u0027t affect the\n   local reference held by zswap-shrink work\n6. zswap-shrink work writes back A at X, and frees zswap entry A\n7. swapin of slot X brings A in memory instead of B\n\nThe fix:\nOnce the swap page cache has been allocated (case ZSWAP_SWAPCACHE_NEW),\nzswap-shrink work just checks that the local zswap_entry reference is\nstill the same as the one in the tree.  If it\u0027s not the same it means that\nit\u0027s either been invalidated or replaced, in both cases the writeback is\naborted because the local entry contains stale data.\n\nReproducer:\nI originally found this by running `stress` overnight to validate my work\non the zswap writeback mechanism, it manifested after hours on my test\nmachine.  The key to make it happen is having zswap writebacks, so\nwhatever setup pumps /sys/kernel/debug/zswap/written_back_pages should do\nthe trick.\n\nIn order to reproduce this faster on a vm, I setup a system with ~100M of\navailable memory and a 500M swap file, then running `stress --vm 1\n--vm-bytes 300000000 --vm-stride 4000` makes it happen in matter of tens\nof minutes.  One can speed things up even more by swinging\n/sys/module/zswap/parameters/max_pool_percent up and down between, say, 20\nand 1; this makes it reproduce in tens of seconds.  It\u0027s crucial to set\n`--vm-stride` to something other than 4096 otherwise `stress` won\u0027t\nrealize that memory has been corrupted because all pages would have the\nsame data."
        }
      ],
      "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 bug is in zswap_writeback_entry(), reached only through local reclaim (frontswap_store \u2192 zswap shrink work \u2192 zpool evict) when anonymous pages are swapped; it is not reachable from network packet processing.\nAC:L - An unprivileged attacker can drive both sides of the race by filling the zswap pool to queue shrink/writeback while concurrently freeing and reallocating memory to invalidate and recycle the same swap slot, and can retry until the race wins.\nPR:L - Triggering requires only an unprivileged local account that can allocate/fault anonymous memory under swap pressure; no root or init-namespace capabilities are needed once zswap and swap are enabled.\nUI:N - The attacker triggers writeback, invalidation, and slot reuse entirely through their own memory operations without needing a victim user to take any action.\nS:U - Impact is confined to the local OS kernel\u2019s memory/swap authority (wrong userspace page contents on swap-in); this is not a VM/IOMMU/sandbox boundary escape.\nC:H - When a recycled swap slot is written back with a prior owner\u2019s page data, the new owner can fault in another process\u2019s swapped anonymous page contents, disclosing arbitrary secrets that passed through zswap writeback.\nI:H - The same race overwrites the victim\u2019s swap slot (and swap-cache page) with attacker- or other-process-controlled page data, so on swap-in the victim\u2019s memory is replaced with foreign contents\u2014full integrity loss for affected pages.\nA:H - Corrupted anonymous pages cause process crashes and application failure under memory pressure, matching the observed stress-test memory corruption and constituting a high availability impact."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T09:12:56.392Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/2cab13f500a6333bd2b853783ac76be9e4956f8a"
        },
        {
          "url": "https://git.kernel.org/stable/c/ba700ea13bf0105a4773c654f7d3bef8adb64ab2"
        },
        {
          "url": "https://git.kernel.org/stable/c/04fc7816089c5a32c29a04ec94b998e219dfb946"
        }
      ],
      "title": "mm: fix zswap writeback race condition",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2023-53178",
    "datePublished": "2025-09-15T14:04:23.768Z",
    "dateReserved": "2025-09-15T13:59:19.065Z",
    "dateUpdated": "2026-08-05T09:12:56.392Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "vulnrichment": {
      "containers": "{\"adp\": [{\"title\": \"CISA ADP Vulnrichment\", \"metrics\": [{\"other\": {\"type\": \"ssvc\", \"content\": {\"id\": \"CVE-2023-53178\", \"role\": \"CISA Coordinator\", \"options\": [{\"Exploitation\": \"none\"}, {\"Automatable\": \"no\"}, {\"Technical Impact\": \"partial\"}], \"version\": \"2.0.3\", \"timestamp\": \"2026-06-10T20:42:26.000674Z\"}}}], \"providerMetadata\": {\"orgId\": \"134c704f-9b21-4f2e-91b3-4a467353bcc0\", \"shortName\": \"CISA-ADP\", \"dateUpdated\": \"2026-06-11T17:39:24.283Z\"}}], \"cna\": {\"title\": \"mm: fix zswap writeback race condition\", \"metrics\": [{\"cvssV3_1\": {\"version\": \"3.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\"}, \"scenarios\": [{\"lang\": \"en\", \"value\": \"AV:L - The bug is in zswap_writeback_entry(), reached only through local reclaim (frontswap_store \\u2192 zswap shrink work \\u2192 zpool evict) when anonymous pages are swapped; it is not reachable from network packet processing.\\nAC:L - An unprivileged attacker can drive both sides of the race by filling the zswap pool to queue shrink/writeback while concurrently freeing and reallocating memory to invalidate and recycle the same swap slot, and can retry until the race wins.\\nPR:L - Triggering requires only an unprivileged local account that can allocate/fault anonymous memory under swap pressure; no root or init-namespace capabilities are needed once zswap and swap are enabled.\\nUI:N - The attacker triggers writeback, invalidation, and slot reuse entirely through their own memory operations without needing a victim user to take any action.\\nS:U - Impact is confined to the local OS kernel\\u2019s memory/swap authority (wrong userspace page contents on swap-in); this is not a VM/IOMMU/sandbox boundary escape.\\nC:H - When a recycled swap slot is written back with a prior owner\\u2019s page data, the new owner can fault in another process\\u2019s swapped anonymous page contents, disclosing arbitrary secrets that passed through zswap writeback.\\nI:H - The same race overwrites the victim\\u2019s swap slot (and swap-cache page) with attacker- or other-process-controlled page data, so on swap-in the victim\\u2019s memory is replaced with foreign contents\\u2014full integrity loss for affected pages.\\nA:H - Corrupted anonymous pages cause process crashes and application failure under memory pressure, matching the observed stress-test memory corruption and constituting a high availability impact.\"}]}], \"affected\": [{\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"2b2811178e85553405b86e3fe78357b9b95889ce\", \"lessThan\": \"2cab13f500a6333bd2b853783ac76be9e4956f8a\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"2b2811178e85553405b86e3fe78357b9b95889ce\", \"lessThan\": \"ba700ea13bf0105a4773c654f7d3bef8adb64ab2\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"2b2811178e85553405b86e3fe78357b9b95889ce\", \"lessThan\": \"04fc7816089c5a32c29a04ec94b998e219dfb946\", \"versionType\": \"git\"}], \"programFiles\": [\"mm/zswap.c\"], \"defaultStatus\": \"unaffected\"}, {\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"3.11\"}, {\"status\": \"unaffected\", \"version\": \"0\", \"lessThan\": \"3.11\", \"versionType\": \"semver\"}, {\"status\": \"unaffected\", \"version\": \"6.1.30\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"6.1.*\"}, {\"status\": \"unaffected\", \"version\": \"6.3.4\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"6.3.*\"}, {\"status\": \"unaffected\", \"version\": \"6.4\", \"versionType\": \"original_commit_for_fix\", \"lessThanOrEqual\": \"*\"}], \"programFiles\": [\"mm/zswap.c\"], \"defaultStatus\": \"affected\"}], \"references\": [{\"url\": \"https://git.kernel.org/stable/c/2cab13f500a6333bd2b853783ac76be9e4956f8a\"}, {\"url\": \"https://git.kernel.org/stable/c/ba700ea13bf0105a4773c654f7d3bef8adb64ab2\"}, {\"url\": \"https://git.kernel.org/stable/c/04fc7816089c5a32c29a04ec94b998e219dfb946\"}], \"x_generator\": {\"engine\": \"bippy-1.2.0\"}, \"descriptions\": [{\"lang\": \"en\", \"value\": \"In the Linux kernel, the following vulnerability has been resolved:\\n\\nmm: fix zswap writeback race condition\\n\\nThe zswap writeback mechanism can cause a race condition resulting in\\nmemory corruption, where a swapped out page gets swapped in with data that\\nwas written to a different page.\\n\\nThe race unfolds like this:\\n1. a page with data A and swap offset X is stored in zswap\\n2. page A is removed off the LRU by zpool driver for writeback in\\n   zswap-shrink work, data for A is mapped by zpool driver\\n3. user space program faults and invalidates page entry A, offset X is\\n   considered free\\n4. kswapd stores page B at offset X in zswap (zswap could also be\\n   full, if so, page B would then be IOed to X, then skip step 5.)\\n5. entry A is replaced by B in tree-\u003erbroot, this doesn\u0027t affect the\\n   local reference held by zswap-shrink work\\n6. zswap-shrink work writes back A at X, and frees zswap entry A\\n7. swapin of slot X brings A in memory instead of B\\n\\nThe fix:\\nOnce the swap page cache has been allocated (case ZSWAP_SWAPCACHE_NEW),\\nzswap-shrink work just checks that the local zswap_entry reference is\\nstill the same as the one in the tree.  If it\u0027s not the same it means that\\nit\u0027s either been invalidated or replaced, in both cases the writeback is\\naborted because the local entry contains stale data.\\n\\nReproducer:\\nI originally found this by running `stress` overnight to validate my work\\non the zswap writeback mechanism, it manifested after hours on my test\\nmachine.  The key to make it happen is having zswap writebacks, so\\nwhatever setup pumps /sys/kernel/debug/zswap/written_back_pages should do\\nthe trick.\\n\\nIn order to reproduce this faster on a vm, I setup a system with ~100M of\\navailable memory and a 500M swap file, then running `stress --vm 1\\n--vm-bytes 300000000 --vm-stride 4000` makes it happen in matter of tens\\nof minutes.  One can speed things up even more by swinging\\n/sys/module/zswap/parameters/max_pool_percent up and down between, say, 20\\nand 1; this makes it reproduce in tens of seconds.  It\u0027s crucial to set\\n`--vm-stride` to something other than 4096 otherwise `stress` won\u0027t\\nrealize that memory has been corrupted because all pages would have the\\nsame data.\"}], \"cpeApplicability\": [{\"nodes\": [{\"negate\": false, \"cpeMatch\": [{\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"6.1.30\", \"versionStartIncluding\": \"3.11\"}, {\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"6.3.4\", \"versionStartIncluding\": \"3.11\"}, {\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"6.4\", \"versionStartIncluding\": \"3.11\"}], \"operator\": \"OR\"}]}], \"providerMetadata\": {\"orgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"shortName\": \"Linux\", \"dateUpdated\": \"2026-08-05T09:12:56.392Z\"}}}",
      "cveMetadata": "{\"cveId\": \"CVE-2023-53178\", \"state\": \"PUBLISHED\", \"dateUpdated\": \"2026-08-05T09:12:56.392Z\", \"dateReserved\": \"2025-09-15T13:59:19.065Z\", \"assignerOrgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"datePublished\": \"2025-09-15T14:04:23.768Z\", \"assignerShortName\": \"Linux\"}",
      "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…