arm64: entry: fix ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
Description
In the Linux kernel, the following vulnerability has been resolved:
arm64: entry: fix ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
Currently the ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD workaround isn't quite right, as it is supposed to be applied after the last explicit memory access, but is immediately followed by an LDR.
The ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD workaround is used to handle Cortex-A520 erratum 2966298 and Cortex-A510 erratum 3117295, which are described in:
- https://developer.arm.com/documentation/SDEN2444153/0600/?lang=en
- https://developer.arm.com/documentation/SDEN1873361/1600/?lang=en
In both cases the workaround is described as:
| If pagetable isolation is disabled, the context switch logic in the | kernel can be updated to execute the following sequence on affected | cores before exiting to EL0, and after all explicit memory accesses: | | 1. A non-shareable TLBI to any context and/or address, including | unused contexts or addresses, such as a TLBI VALE1 Xzr. | | 2. A DSB NSH to guarantee completion of the TLBI.
The important part being that the TLBI+DSB must be placed "after all explicit memory accesses".
Unfortunately, as-implemented, the TLBI+DSB is immediately followed by an LDR, as we have:
| alternative_if ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD | tlbi vale1, xzr | dsb nsh | alternative_else_nop_endif | alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 | ldr lr, [sp, #S_LR] | add sp, sp, #PT_REGS_SIZE // restore sp | eret | alternative_else_nop_endif | | [ ... KPTI exception return path ... ]
This patch fixes this by reworking the logic to place the TLBI+DSB immediately before the ERET, after all explicit memory accesses.
The ERET is currently in a separate alternative block, and alternatives cannot be nested. To account for this, the alternative block for ARM64_UNMAP_KERNEL_AT_EL0 is replaced with a single alternative branch to skip the KPTI logic, with the new shape of the logic being:
| alternative_insn "b .L_skip_tramp_exit_\@", nop, ARM64_UNMAP_KERNEL_AT_EL0 | [ ... KPTI exception return path ... ] | .L_skip_tramp_exit_\@: | | ldr lr, [sp, #S_LR] | add sp, sp, #PT_REGS_SIZE // restore sp | | alternative_if ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD | tlbi vale1, xzr | dsb nsh | alternative_else_nop_endif | eret
The new structure means that the workaround is only applied when KPTI is not in use; this is fine as noted in the documented implications of the erratum:
| Pagetable isolation between EL0 and higher level ELs prevents the | issue from occurring.
... and as per the workaround description quoted above, the workaround is only necessary "If pagetable isolation is disabled".
Affected products
50- osv-coords49 versionspkg:deb/ubuntu/linux-aws@6.5.0-1021.21?arch=source&distro=manticpkg:deb/ubuntu/linux-laptop@6.5.0-1017.20?arch=source&distro=manticpkg:deb/ubuntu/linux-oem-6.5pkg:deb/ubuntu/linux-oracle@6.5.0-1024.24?arch=source&distro=manticpkg:rpm/opensuse/dtb-aarch64&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-64kb&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-azure&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-debug&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-default-base&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-default&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-docs&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-kvmsmall&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-obs-build&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-obs-qa&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-rt_debug&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-rt&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-source-azure&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-source&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-source-rt&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-syms-azure&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-syms&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-syms-rt&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/kernel-zfcpdump&distro=openSUSE%20Leap%2015.5pkg:rpm/suse/kernel-64kb&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP5pkg:rpm/suse/kernel-azure&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Public%20Cloud%2015%20SP5pkg:rpm/suse/kernel-default-base&distro=SUSE%20Linux%20Enterprise%20Micro%205.5pkg:rpm/suse/kernel-default-base&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP5pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2015%20SP5pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Live%20Patching%2015%20SP5pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Micro%205.5pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP5pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Legacy%2015%20SP5pkg:rpm/suse/kernel-default&distro=SUSE%20Linux%20Enterprise%20Workstation%20Extension%2015%20SP5pkg:rpm/suse/kernel-docs&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP5pkg:rpm/suse/kernel-livepatch-SLE15-SP5-RT_Update_13&distro=SUSE%20Linux%20Enterprise%20Live%20Patching%2015%20SP5pkg:rpm/suse/kernel-livepatch-SLE15-SP5_Update_12&distro=SUSE%20Linux%20Enterprise%20Live%20Patching%2015%20SP5pkg:rpm/suse/kernel-obs-build&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP5pkg:rpm/suse/kernel-rt_debug&distro=SUSE%20Real%20Time%20Module%2015%20SP5pkg:rpm/suse/kernel-rt&distro=SUSE%20Linux%20Enterprise%20Micro%205.5pkg:rpm/suse/kernel-rt&distro=SUSE%20Real%20Time%20Module%2015%20SP5pkg:rpm/suse/kernel-source-azure&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Public%20Cloud%2015%20SP5pkg:rpm/suse/kernel-source&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP5pkg:rpm/suse/kernel-source&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP5pkg:rpm/suse/kernel-source-rt&distro=SUSE%20Linux%20Enterprise%20Micro%205.5pkg:rpm/suse/kernel-source-rt&distro=SUSE%20Real%20Time%20Module%2015%20SP5pkg:rpm/suse/kernel-syms-azure&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Public%20Cloud%2015%20SP5pkg:rpm/suse/kernel-syms&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP5pkg:rpm/suse/kernel-syms-rt&distro=SUSE%20Real%20Time%20Module%2015%20SP5pkg:rpm/suse/kernel-zfcpdump&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP5
< 6.5.0-1021.21+ 48 more
- (no CPE)range: < 6.5.0-1021.21
- (no CPE)range: < 6.5.0-1017.20
- (no CPE)range: < 6.5.0-1022.23
- (no CPE)range: < 6.5.0-1024.24
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.33.48.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1.150500.6.25.7
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.33.48.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.33.48.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.33.48.1
- (no CPE)range: < 5.14.21-150500.55.59.1.150500.6.25.7
- (no CPE)range: < 5.14.21-150500.55.59.1.150500.6.25.7
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 1-150500.11.3.1
- (no CPE)range: < 1-150500.11.7.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.33.48.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.33.48.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- (no CPE)range: < 5.14.21-150500.13.47.1
- (no CPE)range: < 5.14.21-150500.55.59.1
- Linux/Linuxv5Range: 6.6
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
3News mentions
0No linked articles in our index yet.