Lucene search

K
cve416baaa9-dc9f-4396-8d5f-8c081fb06d67CVE-2021-47350
HistoryMay 21, 2024 - 3:15 p.m.

CVE-2021-47350

2024-05-2115:15:21
416baaa9-dc9f-4396-8d5f-8c081fb06d67
web.nvd.nist.gov
30
linux kernel
powerpc
kernel exec fault
page_exec
nvd
access flags filter

6.6 Medium

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

15.7%

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.

Affected configurations

Vulners
Node
linuxlinux_kernelRange4.145.4.133
OR
linuxlinux_kernelRange5.5.05.10.51
OR
linuxlinux_kernelRange5.11.05.12.18
OR
linuxlinux_kernelRange5.13.05.13.3
OR
linuxlinux_kernelRange5.14.0

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "arch/powerpc/mm/fault.c"
    ],
    "versions": [
      {
        "version": "d3ca587404b3",
        "lessThan": "a82471a14aad",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "d3ca587404b3",
        "lessThan": "d2e52d466409",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "d3ca587404b3",
        "lessThan": "500f81cec9f1",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "d3ca587404b3",
        "lessThan": "8a96ec5ebf96",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "d3ca587404b3",
        "lessThan": "cd5d5e602f50",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "arch/powerpc/mm/fault.c"
    ],
    "versions": [
      {
        "version": "4.14",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "4.14",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.4.133",
        "lessThanOrEqual": "5.4.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.10.51",
        "lessThanOrEqual": "5.10.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.12.18",
        "lessThanOrEqual": "5.12.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.13.3",
        "lessThanOrEqual": "5.13.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.14",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

6.6 Medium

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

15.7%