CVE-2021-47350
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
21/05/2024
Last modified:
02/04/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
powerpc/mm: Fix lockup on kernel exec fault<br />
<br />
The powerpc kernel is not prepared to handle exec faults from kernel.<br />
Especially, the function is_exec_fault() will return &#39;false&#39; when an<br />
exec fault is taken by kernel, because the check is based on reading<br />
current->thread.regs->trap which contains the trap from user.<br />
<br />
For instance, when provoking a LKDTM EXEC_USERSPACE test,<br />
current->thread.regs->trap is set to SYSCALL trap (0xc00), and<br />
the fault taken by the kernel is not seen as an exec fault by<br />
set_access_flags_filter().<br />
<br />
Commit d7df2443cd5f ("powerpc/mm: Fix spurious segfaults on radix<br />
with autonuma") made it clear and handled it properly. But later on<br />
commit d3ca587404b3 ("powerpc/mm: Fix reporting of kernel execute<br />
faults") removed that handling, introducing test based on error_code.<br />
And here is the problem, because on the 603 all upper bits of SRR1<br />
get cleared when the TLB instruction miss handler bails out to ISI.<br />
<br />
Until commit cbd7e6ca0210 ("powerpc/fault: Avoid heavy<br />
search_exception_tables() verification"), an exec fault from kernel<br />
at a userspace address was indirectly caught by the lack of entry for<br />
that address in the exception tables. But after that commit the<br />
kernel mainly relies on KUAP or on core mm handling to catch wrong<br />
user accesses. Here the access is not wrong, so mm handles it.<br />
It is a minor fault because PAGE_EXEC is not set,<br />
set_access_flags_filter() should set PAGE_EXEC and voila.<br />
But as is_exec_fault() returns false as explained in the beginning,<br />
set_access_flags_filter() bails out without setting PAGE_EXEC flag,<br />
which leads to a forever minor exec fault.<br />
<br />
As the kernel is not prepared to handle such exec faults, the thing to<br />
do is to fire in bad_kernel_fault() for any exec fault taken by the<br />
kernel, as it was prior to commit d3ca587404b3.
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.14 (including) | 5.4.133 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.51 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.12.18 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.13 (including) | 5.13.3 (excluding) |
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/500f81cec9f1bfa5210aa9dd5ba9a06e22f62a35
- https://git.kernel.org/stable/c/8a96ec5ebf96ad8e2ba7b1b34103a0be5140fc70
- https://git.kernel.org/stable/c/a82471a14aad90f79d1608d2bcbb019f0ffb53f0
- https://git.kernel.org/stable/c/cd5d5e602f502895e47e18cd46804d6d7014e65c
- https://git.kernel.org/stable/c/d2e52d4664097a6c1f591d869ec594bd7a0d4925
- https://git.kernel.org/stable/c/500f81cec9f1bfa5210aa9dd5ba9a06e22f62a35
- https://git.kernel.org/stable/c/8a96ec5ebf96ad8e2ba7b1b34103a0be5140fc70
- https://git.kernel.org/stable/c/a82471a14aad90f79d1608d2bcbb019f0ffb53f0
- https://git.kernel.org/stable/c/cd5d5e602f502895e47e18cd46804d6d7014e65c
- https://git.kernel.org/stable/c/d2e52d4664097a6c1f591d869ec594bd7a0d4925



