CVE-2021-47350
powerpc/mm: Fix lockup on kernel exec fault
Check your servers for CVE-2021-47350
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-2021-47350 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:
powerpc/mm: Fix lockup on kernel exec fault
The powerpc kernel is not prepared to handle exec faults from kernel. Especially, the function is_exec_fault() will return 'false' when an exec fault is taken by kernel, because the check is based on reading current->thread.regs->trap which contains the trap from user.
For instance, when provoking a LKDTM EXEC_USERSPACE test, current->thread.regs->trap is set to SYSCALL trap (0xc00), and the fault taken by the kernel is not seen as an exec fault by set_access_flags_filter().
Commit d7df2443cd5f ("powerpc/mm: Fix spurious segfaults on radix with autonuma") made it clear and handled it properly. But later on commit d3ca587404b3 ("powerpc/mm: Fix reporting of kernel execute faults") removed that handling, introducing test based on error_code. And here is the problem, because on the 603 all upper bits of SRR1 get cleared when the TLB instruction miss handler bails out to ISI.
Until commit cbd7e6ca0210 ("powerpc/fault: Avoid heavy search_exception_tables() verification"), an exec fault from kernel at a userspace address was indirectly caught by the lack of entry for that address in the exception tables. But after that commit the kernel mainly relies on KUAP or on core mm handling to catch wrong user accesses. Here the access is not wrong, so mm handles it. It is a minor fault because PAGE_EXEC is not set, set_access_flags_filter() should set PAGE_EXEC and voila. But as is_exec_fault() returns false as explained in the beginning, set_access_flags_filter() bails out without setting PAGE_EXEC flag, which leads to a forever minor exec fault.
As the kernel is not prepared to handle such exec faults, the thing to do is to fire in bad_kernel_fault() for any exec fault taken by the kernel, as it was prior to commit d3ca587404b3.
Severity (CVSS)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/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 none, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.18%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 8.02% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 29 May 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from d3ca587404b36943b02df87406054ce73cc49500, before a82471a14aad90f79d1608d2bcbb019f0ffb53f0 affected from d3ca587404b36943b02df87406054ce73cc49500, before d2e52d4664097a6c1f591d869ec594bd7a0d4925 affected from d3ca587404b36943b02df87406054ce73cc49500, before 500f81cec9f1bfa5210aa9dd5ba9a06e22f62a35 affected from d3ca587404b36943b02df87406054ce73cc49500, before 8a96ec5ebf96ad8e2ba7b1b34103a0be5140fc70 affected from d3ca587404b36943b02df87406054ce73cc49500, before cd5d5e602f502895e47e18cd46804d6d7014e65c
Other versions: unaffected
|
| Linux |
affected 4.14 unaffected before 4.14 unaffected from 5.4.133 up to and including 5.4.* unaffected from 5.10.51 up to and including 5.10.* unaffected from 5.12.18 up to and including 5.12.* unaffected from 5.13.3 up to and including 5.13.* unaffected 5.14 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-2021-47350 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2021-47350
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-2021-47350
trivy image --scanners vuln IMAGE | grep CVE-2021-47350
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/a82471a14aad90f79d1608d2bcbb019f0ffb53f0 git.kernel.org
- https://git.kernel.org/stable/c/d2e52d4664097a6c1f591d869ec594bd7a0d4925 git.kernel.org
- https://git.kernel.org/stable/c/500f81cec9f1bfa5210aa9dd5ba9a06e22f62a35 git.kernel.org
- https://git.kernel.org/stable/c/8a96ec5ebf96ad8e2ba7b1b34103a0be5140fc70 git.kernel.org
- https://git.kernel.org/stable/c/cd5d5e602f502895e47e18cd46804d6d7014e65c git.kernel.org
Source: the record CVE-2021-47350 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse