提交 357bd9f9 编写于 作者: J James Morse 提交者: Yongqiang Liu

arm64: entry.S: Add ventry overflow sanity checks

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

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

commit 4330e2c5 upstream.

Subsequent patches add even more code to the ventry slots.
Ensure kernels that overflow a ventry slot don't get built.
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>
上级 5308da81
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
.macro kernel_ventry, el, label, regsize = 64 .macro kernel_ventry, el, label, regsize = 64
.align 7 .align 7
.Lventry_start\@:
#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
alternative_if ARM64_UNMAP_KERNEL_AT_EL0 alternative_if ARM64_UNMAP_KERNEL_AT_EL0
.if \el == 0 .if \el == 0
...@@ -127,6 +128,7 @@ alternative_else_nop_endif ...@@ -127,6 +128,7 @@ alternative_else_nop_endif
mrs x0, tpidrro_el0 mrs x0, tpidrro_el0
#endif #endif
b el\()\el\()_\label b el\()\el\()_\label
.org .Lventry_start\@ + 128 // Did we overflow the ventry slot?
.endm .endm
.macro tramp_alias, dst, sym .macro tramp_alias, dst, sym
...@@ -1084,6 +1086,7 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 ...@@ -1084,6 +1086,7 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003
add x30, x30, #(1b - tramp_vectors) add x30, x30, #(1b - tramp_vectors)
isb isb
ret ret
.org 1b + 128 // Did we overflow the ventry slot?
.endm .endm
.macro tramp_exit, regsize = 64 .macro tramp_exit, regsize = 64
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册