{"dataType":"CVE_RECORD","dataVersion":"5.1","cveMetadata":{"cveId":"CVE-2022-49052","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2025-02-26T01:49:39.242Z","datePublished":"2025-02-26T01:54:26.322Z","dateUpdated":"2025-05-04T08:28:42.999Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2025-05-04T08:28:42.999Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: fix unexpected zeroed page mapping with zram swap\n\nTwo processes under CLONE_VM cloning, user process can be corrupted by\nseeing zeroed page unexpectedly.\n\n      CPU A                        CPU B\n\n  do_swap_page                do_swap_page\n  SWP_SYNCHRONOUS_IO path     SWP_SYNCHRONOUS_IO path\n  swap_readpage valid data\n    swap_slot_free_notify\n      delete zram entry\n                              swap_readpage zeroed(invalid) data\n                              pte_lock\n                              map the *zero data* to userspace\n                              pte_unlock\n  pte_lock\n  if (!pte_same)\n    goto out_nomap;\n  pte_unlock\n  return and next refault will\n  read zeroed data\n\nThe swap_slot_free_notify is bogus for CLONE_VM case since it doesn't\nincrease the refcount of swap slot at copy_mm so it couldn't catch up\nwhether it's safe or not to discard data from backing device.  In the\ncase, only the lock it could rely on to synchronize swap slot freeing is\npage table lock.  Thus, this patch gets rid of the swap_slot_free_notify\nfunction.  With this patch, CPU A will see correct data.\n\n      CPU A                        CPU B\n\n  do_swap_page                do_swap_page\n  SWP_SYNCHRONOUS_IO path     SWP_SYNCHRONOUS_IO path\n                              swap_readpage original data\n                              pte_lock\n                              map the original data\n                              swap_free\n                                swap_range_free\n                                  bd_disk->fops->swap_slot_free_notify\n  swap_readpage read zeroed data\n                              pte_unlock\n  pte_lock\n  if (!pte_same)\n    goto out_nomap;\n  pte_unlock\n  return\n  on next refault will see mapped data by CPU B\n\nThe concern of the patch would increase memory consumption since it\ncould keep wasted memory with compressed form in zram as well as\nuncompressed form in address space.  However, most of cases of zram uses\nno readahead and do_swap_page is followed by swap_free so it will free\nthe compressed form from in zram quickly."}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/page_io.c"],"versions":[{"version":"0bcac06f27d7528591c27ac2b093ccd71c5d0168","lessThan":"f86d55cf616199404c05f5b0c5c41b17351baa02","status":"affected","versionType":"git"},{"version":"0bcac06f27d7528591c27ac2b093ccd71c5d0168","lessThan":"f098f8b9820fe3f2e41aefc4329dfe8a3859d1c1","status":"affected","versionType":"git"},{"version":"0bcac06f27d7528591c27ac2b093ccd71c5d0168","lessThan":"20ed94f8181a25212e7404e44958e234f407624b","status":"affected","versionType":"git"},{"version":"0bcac06f27d7528591c27ac2b093ccd71c5d0168","lessThan":"12ba1d38115a101c45d8e0ca3aa1181fd148e57f","status":"affected","versionType":"git"},{"version":"0bcac06f27d7528591c27ac2b093ccd71c5d0168","lessThan":"afac4b88699a06c8b9369f9d759a1ec3c254b788","status":"affected","versionType":"git"},{"version":"0bcac06f27d7528591c27ac2b093ccd71c5d0168","lessThan":"e914d8f00391520ecc4495dd0ca0124538ab7119","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/page_io.c"],"versions":[{"version":"4.15","status":"affected"},{"version":"0","lessThan":"4.15","status":"unaffected","versionType":"semver"},{"version":"4.19.242","lessThanOrEqual":"4.19.*","status":"unaffected","versionType":"semver"},{"version":"5.4.193","lessThanOrEqual":"5.4.*","status":"unaffected","versionType":"semver"},{"version":"5.10.112","lessThanOrEqual":"5.10.*","status":"unaffected","versionType":"semver"},{"version":"5.15.35","lessThanOrEqual":"5.15.*","status":"unaffected","versionType":"semver"},{"version":"5.17.4","lessThanOrEqual":"5.17.*","status":"unaffected","versionType":"semver"},{"version":"5.18","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"4.19.242"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"5.4.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"5.10.112"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"5.15.35"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"5.17.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.15","versionEndExcluding":"5.18"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/f86d55cf616199404c05f5b0c5c41b17351baa02"},{"url":"https://git.kernel.org/stable/c/f098f8b9820fe3f2e41aefc4329dfe8a3859d1c1"},{"url":"https://git.kernel.org/stable/c/20ed94f8181a25212e7404e44958e234f407624b"},{"url":"https://git.kernel.org/stable/c/12ba1d38115a101c45d8e0ca3aa1181fd148e57f"},{"url":"https://git.kernel.org/stable/c/afac4b88699a06c8b9369f9d759a1ec3c254b788"},{"url":"https://git.kernel.org/stable/c/e914d8f00391520ecc4495dd0ca0124538ab7119"}],"title":"mm: fix unexpected zeroed page mapping with zram swap","x_generator":{"engine":"bippy-1.2.0"}}}}