CVE-2022-49647
cgroup: Use separate src/dst nodes when preloading css_sets for migration
Check your servers for CVE-2022-49647
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-49647 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:
cgroup: Use separate src/dst nodes when preloading css_sets for migration
Each cset (css_set) is pinned by its tasks. When we're moving tasks around across csets for a migration, we need to hold the source and destination csets to ensure that they don't go away while we're moving tasks about. This is done by linking cset->mg_preload_node on either the mgctx->preloaded_src_csets or mgctx->preloaded_dst_csets list. Using the same cset->mg_preload_node for both the src and dst lists was deemed okay as a cset can't be both the source and destination at the same time.
Unfortunately, this overloading becomes problematic when multiple tasks are involved in a migration and some of them are identity noop migrations while others are actually moving across cgroups. For example, this can happen with the following sequence on cgroup1:
#1> mkdir -p /sys/fs/cgroup/misc/a/b #2> echo $$ > /sys/fs/cgroup/misc/a/cgroup.procs #3> RUN_A_COMMAND_WHICH_CREATES_MULTIPLE_THREADS & #4> PID=$! #5> echo $PID > /sys/fs/cgroup/misc/a/b/tasks #6> echo $PID > /sys/fs/cgroup/misc/a/cgroup.procs
the process including the group leader back into a. In this final migration, non-leader threads would be doing identity migration while the group leader is doing an actual one.
After #3, let's say the whole process was in cset A, and that after #4, the leader moves to cset B. Then, during #6, the following happens:
1. cgroup_migrate_add_src() is called on B for the leader.
2. cgroup_migrate_add_src() is called on A for the other threads.
3. cgroup_migrate_prepare_dst() is called. It scans the src list.
4. It notices that B wants to migrate to A, so it tries to A to the dst list but realizes that its ->mg_preload_node is already busy.
5. and then it notices A wants to migrate to A as it's an identity migration, it culls it by list_del_init()'ing its ->mg_preload_node and putting references accordingly.
6. The rest of migration takes place with B on the src list but nothing on the dst list.
This means that A isn't held while migration is in progress. If all tasks leave A before the migration finishes and the incoming task pins it, the cset will be destroyed leading to use-after-free.
This is caused by overloading cset->mg_preload_node for both src and dst preload lists. We wanted to exclude the cset from the src list but ended up inadvertently excluding it from the dst list too.
This patch fixes the issue by separating out cset->mg_preload_node into ->mg_src_preload_node and ->mg_dst_preload_node, so that the src and dst preloadings don't interfere with each other.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/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 high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/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 high, 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.0% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 27 Feb 2025):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- total: full control of the component or of its data
Weakness
- CWE-416 Use After Free
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from f817de98513d060023be4fa1d061b29a6515273e, before 05f7658210d1d331e8dd4cb6e7bbbe3df5f5ac27 affected from f817de98513d060023be4fa1d061b29a6515273e, before cec2bbdcc14fbaa6b95ee15a7c423b05d97038be affected from f817de98513d060023be4fa1d061b29a6515273e, before ad44e05f3e016bdcb1ad25af35ade5b5f41ccd68 affected from f817de98513d060023be4fa1d061b29a6515273e, before 7657e3958535d101a24ab4400f9b8062b9107cc4 affected from f817de98513d060023be4fa1d061b29a6515273e, before 54aee4e5ce8c21555286a6333e46c1713880cf93 affected from f817de98513d060023be4fa1d061b29a6515273e, before 0e41774b564befa6d271e8d5086bf870d617a4e6 affected from f817de98513d060023be4fa1d061b29a6515273e, before 07fd5b6cdf3cc30bfde8fe0f644771688be04447
Other versions: unaffected
|
| Linux |
affected 3.16 unaffected before 3.16 unaffected from 4.14.289 up to and including 4.14.* unaffected from 4.19.253 up to and including 4.19.* unaffected from 5.4.207 up to and including 5.4.* unaffected from 5.10.132 up to and including 5.10.* unaffected from 5.15.56 up to and including 5.15.* unaffected from 5.18.13 up to and including 5.18.* unaffected 5.19 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-49647 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2022-49647
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-49647
trivy image --scanners vuln IMAGE | grep CVE-2022-49647
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/05f7658210d1d331e8dd4cb6e7bbbe3df5f5ac27 git.kernel.org
- https://git.kernel.org/stable/c/cec2bbdcc14fbaa6b95ee15a7c423b05d97038be git.kernel.org
- https://git.kernel.org/stable/c/ad44e05f3e016bdcb1ad25af35ade5b5f41ccd68 git.kernel.org
- https://git.kernel.org/stable/c/7657e3958535d101a24ab4400f9b8062b9107cc4 git.kernel.org
- https://git.kernel.org/stable/c/54aee4e5ce8c21555286a6333e46c1713880cf93 git.kernel.org
- https://git.kernel.org/stable/c/0e41774b564befa6d271e8d5086bf870d617a4e6 git.kernel.org
- https://git.kernel.org/stable/c/07fd5b6cdf3cc30bfde8fe0f644771688be04447 git.kernel.org
Source: the record CVE-2022-49647 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse