CVE-2022-49052

Source
https://cve.org/CVERecord?id=CVE-2022-49052
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49052.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49052
Downstream
Published
2025-02-26T01:54:26.322Z
Modified
2026-03-12T03:24:30.310889Z
Summary
mm: fix unexpected zeroed page mapping with zram swap
Details

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

mm: fix unexpected zeroed page mapping with zram swap

Two processes under CLONE_VM cloning, user process can be corrupted by seeing zeroed page unexpectedly.

  CPU A                        CPU B

doswappage doswappage SWPSYNCHRONOUSIO path SWPSYNCHRONOUSIO path swapreadpage valid data swapslotfreenotify delete zram entry swapreadpage zeroed(invalid) data ptelock map the zero data to userspace pteunlock ptelock if (!ptesame) goto outnomap; pte_unlock return and next refault will read zeroed data

The swapslotfreenotify is bogus for CLONEVM case since it doesn't increase the refcount of swap slot at copymm so it couldn't catch up whether it's safe or not to discard data from backing device. In the case, only the lock it could rely on to synchronize swap slot freeing is page table lock. Thus, this patch gets rid of the swapslotfreenotify function. With this patch, CPU A will see correct data.

  CPU A                        CPU B

doswappage doswappage SWPSYNCHRONOUSIO path SWPSYNCHRONOUSIO path swapreadpage original data ptelock map the original data swapfree swaprangefree bddisk->fops->swapslotfreenotify swapreadpage read zeroed data pteunlock ptelock if (!ptesame) goto outnomap; pte_unlock return on next refault will see mapped data by CPU B

The concern of the patch would increase memory consumption since it could keep wasted memory with compressed form in zram as well as uncompressed form in address space. However, most of cases of zram uses no readahead and doswappage is followed by swap_free so it will free the compressed form from in zram quickly.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49052.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0bcac06f27d7528591c27ac2b093ccd71c5d0168
Fixed
f86d55cf616199404c05f5b0c5c41b17351baa02
Fixed
f098f8b9820fe3f2e41aefc4329dfe8a3859d1c1
Fixed
20ed94f8181a25212e7404e44958e234f407624b
Fixed
12ba1d38115a101c45d8e0ca3aa1181fd148e57f
Fixed
afac4b88699a06c8b9369f9d759a1ec3c254b788
Fixed
e914d8f00391520ecc4495dd0ca0124538ab7119

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49052.json"