CVE-2022-49052
mm: fix unexpected zeroed page mapping with zram swap
Check your servers for CVE-2022-49052
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-49052 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
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
do_swap_page do_swap_page SWP_SYNCHRONOUS_IO path SWP_SYNCHRONOUS_IO path swap_readpage valid data swap_slot_free_notify delete zram entry swap_readpage zeroed(invalid) data pte_lock map the *zero data* to userspace pte_unlock pte_lock if (!pte_same) goto out_nomap; pte_unlock return and next refault will read zeroed data
The swap_slot_free_notify is bogus for CLONE_VM case since it doesn't increase the refcount of swap slot at copy_mm 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 swap_slot_free_notify function. With this patch, CPU A will see correct data.
CPU A CPU B
do_swap_page do_swap_page SWP_SYNCHRONOUS_IO path SWP_SYNCHRONOUS_IO path swap_readpage original data pte_lock map the original data swap_free swap_range_free bd_disk->fops->swap_slot_free_notify swap_readpage read zeroed data pte_unlock pte_lock if (!pte_same) goto out_nomap; 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 do_swap_page is followed by swap_free so it will free the compressed form from in zram quickly.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality none, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.29%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 23.1% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 0bcac06f27d7528591c27ac2b093ccd71c5d0168, before f86d55cf616199404c05f5b0c5c41b17351baa02 affected from 0bcac06f27d7528591c27ac2b093ccd71c5d0168, before f098f8b9820fe3f2e41aefc4329dfe8a3859d1c1 affected from 0bcac06f27d7528591c27ac2b093ccd71c5d0168, before 20ed94f8181a25212e7404e44958e234f407624b affected from 0bcac06f27d7528591c27ac2b093ccd71c5d0168, before 12ba1d38115a101c45d8e0ca3aa1181fd148e57f affected from 0bcac06f27d7528591c27ac2b093ccd71c5d0168, before afac4b88699a06c8b9369f9d759a1ec3c254b788 affected from 0bcac06f27d7528591c27ac2b093ccd71c5d0168, before e914d8f00391520ecc4495dd0ca0124538ab7119
Other versions: unaffected
|
| Linux |
affected 4.15 unaffected before 4.15 unaffected from 4.19.242 up to and including 4.19.* unaffected from 5.4.193 up to and including 5.4.* unaffected from 5.10.112 up to and including 5.10.* unaffected from 5.15.35 up to and including 5.15.* unaffected from 5.17.4 up to and including 5.17.* unaffected 5.18 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2022-49052 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2022-49052
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2022-49052
trivy image --scanners vuln IMAGE | grep CVE-2022-49052
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/f86d55cf616199404c05f5b0c5c41b17351baa02 git.kernel.org
- https://git.kernel.org/stable/c/f098f8b9820fe3f2e41aefc4329dfe8a3859d1c1 git.kernel.org
- https://git.kernel.org/stable/c/20ed94f8181a25212e7404e44958e234f407624b git.kernel.org
- https://git.kernel.org/stable/c/12ba1d38115a101c45d8e0ca3aa1181fd148e57f git.kernel.org
- https://git.kernel.org/stable/c/afac4b88699a06c8b9369f9d759a1ec3c254b788 git.kernel.org
- https://git.kernel.org/stable/c/e914d8f00391520ecc4495dd0ca0124538ab7119 git.kernel.org
Source: the record CVE-2022-49052 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse