mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
arm64: entry: Add macro for reading symbol addresses from the trampoline
commit b28a8eebe8 upstream.
The trampoline code needs to use the address of symbols in the wider
kernel, e.g. vectors. PC-relative addressing wouldn't work as the
trampoline code doesn't run at the address the linker expected.
tramp_ventry uses a literal pool, unless CONFIG_RANDOMIZE_BASE is
set, in which case it uses the data page as a literal pool because
the data page can be unmapped when running in user-space, which is
required for CPUs vulnerable to meltdown.
Pull this logic out as a macro, instead of adding a third copy
of it.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
[ Removed SDEI for stable backport ]
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
218ddd9cb9
commit
aee10c2dd0
@@ -921,6 +921,15 @@ __ni_sys_trace:
|
|||||||
sub \dst, \dst, PAGE_SIZE
|
sub \dst, \dst, PAGE_SIZE
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro tramp_data_read_var dst, var
|
||||||
|
#ifdef CONFIG_RANDOMIZE_BASE
|
||||||
|
tramp_data_page \dst
|
||||||
|
add \dst, \dst, #:lo12:__entry_tramp_data_\var
|
||||||
|
ldr \dst, [\dst]
|
||||||
|
#else
|
||||||
|
ldr \dst, =\var
|
||||||
|
#endif
|
||||||
|
.endm
|
||||||
|
|
||||||
#define BHB_MITIGATION_NONE 0
|
#define BHB_MITIGATION_NONE 0
|
||||||
#define BHB_MITIGATION_LOOP 1
|
#define BHB_MITIGATION_LOOP 1
|
||||||
@@ -951,13 +960,7 @@ __ni_sys_trace:
|
|||||||
b .
|
b .
|
||||||
2:
|
2:
|
||||||
tramp_map_kernel x30
|
tramp_map_kernel x30
|
||||||
#ifdef CONFIG_RANDOMIZE_BASE
|
tramp_data_read_var x30, vectors
|
||||||
tramp_data_page x30
|
|
||||||
isb
|
|
||||||
ldr x30, [x30]
|
|
||||||
#else
|
|
||||||
ldr x30, =vectors
|
|
||||||
#endif
|
|
||||||
prfm plil1strm, [x30, #(1b - \vector_start)]
|
prfm plil1strm, [x30, #(1b - \vector_start)]
|
||||||
msr vbar_el1, x30
|
msr vbar_el1, x30
|
||||||
isb
|
isb
|
||||||
@@ -1037,7 +1040,12 @@ END(tramp_exit_compat)
|
|||||||
.align PAGE_SHIFT
|
.align PAGE_SHIFT
|
||||||
.globl __entry_tramp_data_start
|
.globl __entry_tramp_data_start
|
||||||
__entry_tramp_data_start:
|
__entry_tramp_data_start:
|
||||||
|
__entry_tramp_data_vectors:
|
||||||
.quad vectors
|
.quad vectors
|
||||||
|
#ifdef CONFIG_ARM_SDE_INTERFACE
|
||||||
|
__entry_tramp_data___sdei_asm_trampoline_next_handler:
|
||||||
|
.quad __sdei_asm_handler
|
||||||
|
#endif /* CONFIG_ARM_SDE_INTERFACE */
|
||||||
.popsection // .rodata
|
.popsection // .rodata
|
||||||
#endif /* CONFIG_RANDOMIZE_BASE */
|
#endif /* CONFIG_RANDOMIZE_BASE */
|
||||||
#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */
|
#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */
|
||||||
|
|||||||
Reference in New Issue
Block a user