提交 7a79d423 编写于 作者: J James Morse 提交者: Yongqiang Liu

arm64: entry: Make the trampoline cleanup optional

stable inclusion
from stable-v4.19.236
commit 87eccd56c52fcdd6c55b048d789da5c9c2e51ed3
category: bugfix
bugzilla: 186460, https://gitee.com/src-openeuler/kernel/issues/I53MHA
CVE: CVE-2022-23960

--------------------------------

commit d739da16 upstream.

Subsequent patches will add additional sets of vectors that use
the same tricks as the kpti vectors to reach the full-fat vectors.
The full-fat vectors contain some cleanup for kpti that is patched
in by alternatives when kpti is in use. Once there are additional
vectors, the cleanup will be needed in more cases.

But on big/little systems, the cleanup would be harmful if no
trampoline vector were in use. Instead of forcing CPUs that don't
need a trampoline vector to use one, make the trampoline cleanup
optional.

Entry at the top of the vectors will skip the cleanup. The trampoline
vectors can then skip the first instruction, triggering the cleanup
to run.
Reviewed-by: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: NJames Morse <james.morse@arm.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jiahao <chenjiahao16@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Reviewed-by: NLiao Chang <liaochang1@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 357bd9f9
...@@ -72,16 +72,20 @@ ...@@ -72,16 +72,20 @@
.align 7 .align 7
.Lventry_start\@: .Lventry_start\@:
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
alternative_if ARM64_UNMAP_KERNEL_AT_EL0
.if \el == 0 .if \el == 0
/*
* This must be the first instruction of the EL0 vector entries. It is
* skipped by the trampoline vectors, to trigger the cleanup.
*/
b .Lskip_tramp_vectors_cleanup\@
.if \regsize == 64 .if \regsize == 64
mrs x30, tpidrro_el0 mrs x30, tpidrro_el0
msr tpidrro_el0, xzr msr tpidrro_el0, xzr
.else .else
mov x30, xzr mov x30, xzr
.endif .endif
.Lskip_tramp_vectors_cleanup\@:
.endif .endif
alternative_else_nop_endif
#endif #endif
sub sp, sp, #S_FRAME_SIZE sub sp, sp, #S_FRAME_SIZE
...@@ -1083,7 +1087,7 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 ...@@ -1083,7 +1087,7 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003
#endif #endif
prfm plil1strm, [x30, #(1b - tramp_vectors)] prfm plil1strm, [x30, #(1b - tramp_vectors)]
msr vbar_el1, x30 msr vbar_el1, x30
add x30, x30, #(1b - tramp_vectors) add x30, x30, #(1b - tramp_vectors + 4)
isb isb
ret ret
.org 1b + 128 // Did we overflow the ventry slot? .org 1b + 128 // Did we overflow the ventry slot?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册