CVE-2022-49052
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
26/02/2025
Last modified:
14/10/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
mm: fix unexpected zeroed page mapping with zram swap<br />
<br />
Two processes under CLONE_VM cloning, user process can be corrupted by<br />
seeing zeroed page unexpectedly.<br />
<br />
CPU A CPU B<br />
<br />
do_swap_page do_swap_page<br />
SWP_SYNCHRONOUS_IO path SWP_SYNCHRONOUS_IO path<br />
swap_readpage valid data<br />
swap_slot_free_notify<br />
delete zram entry<br />
swap_readpage zeroed(invalid) data<br />
pte_lock<br />
map the *zero data* to userspace<br />
pte_unlock<br />
pte_lock<br />
if (!pte_same)<br />
goto out_nomap;<br />
pte_unlock<br />
return and next refault will<br />
read zeroed data<br />
<br />
The swap_slot_free_notify is bogus for CLONE_VM case since it doesn&#39;t<br />
increase the refcount of swap slot at copy_mm so it couldn&#39;t catch up<br />
whether it&#39;s safe or not to discard data from backing device. In the<br />
case, only the lock it could rely on to synchronize swap slot freeing is<br />
page table lock. Thus, this patch gets rid of the swap_slot_free_notify<br />
function. With this patch, CPU A will see correct data.<br />
<br />
CPU A CPU B<br />
<br />
do_swap_page do_swap_page<br />
SWP_SYNCHRONOUS_IO path SWP_SYNCHRONOUS_IO path<br />
swap_readpage original data<br />
pte_lock<br />
map the original data<br />
swap_free<br />
swap_range_free<br />
bd_disk->fops->swap_slot_free_notify<br />
swap_readpage read zeroed data<br />
pte_unlock<br />
pte_lock<br />
if (!pte_same)<br />
goto out_nomap;<br />
pte_unlock<br />
return<br />
on next refault will see mapped data by CPU B<br />
<br />
The concern of the patch would increase memory consumption since it<br />
could keep wasted memory with compressed form in zram as well as<br />
uncompressed form in address space. However, most of cases of zram uses<br />
no readahead and do_swap_page is followed by swap_free so it will free<br />
the compressed form from in zram quickly.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.15 (including) | 4.19.242 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.193 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.112 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.35 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.17.4 (excluding) |
| cpe:2.3:o:linux:linux_kernel:5.18:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:5.18:rc2:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/12ba1d38115a101c45d8e0ca3aa1181fd148e57f
- https://git.kernel.org/stable/c/20ed94f8181a25212e7404e44958e234f407624b
- https://git.kernel.org/stable/c/afac4b88699a06c8b9369f9d759a1ec3c254b788
- https://git.kernel.org/stable/c/e914d8f00391520ecc4495dd0ca0124538ab7119
- https://git.kernel.org/stable/c/f098f8b9820fe3f2e41aefc4329dfe8a3859d1c1
- https://git.kernel.org/stable/c/f86d55cf616199404c05f5b0c5c41b17351baa02



