diff options
author | Will Deacon <will.deacon@arm.com> | 2018-02-05 15:34:20 +0000 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2018-02-06 22:53:35 +0000 |
commit | 6314d90e64936c584f300a52ef173603fb2461b5 (patch) | |
tree | fb62ec15844bee34626b37a80ec6d82d6ee3f26a /arch/arm64/kernel/entry.S | |
parent | 4d8efc2d5ee4c9ccfeb29ee8afd47a8660d0c0ce (diff) | |
download | talos-obmc-linux-6314d90e64936c584f300a52ef173603fb2461b5.tar.gz talos-obmc-linux-6314d90e64936c584f300a52ef173603fb2461b5.zip |
arm64: entry: Ensure branch through syscall table is bounded under speculation
In a similar manner to array_index_mask_nospec, this patch introduces an
assembly macro (mask_nospec64) which can be used to bound a value under
speculation. This macro is then used to ensure that the indirect branch
through the syscall table is bounded under speculation, with out-of-range
addresses speculating as calls to sys_io_setup (0).
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/entry.S')
-rw-r--r-- | arch/arm64/kernel/entry.S | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 17c15f741780..4dd1b5a46642 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -378,6 +378,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 * x7 is reserved for the system call number in 32-bit mode. */ wsc_nr .req w25 // number of system calls +xsc_nr .req x25 // number of system calls (zero-extended) wscno .req w26 // syscall number xscno .req x26 // syscall number (zero-extended) stbl .req x27 // syscall table pointer @@ -935,6 +936,7 @@ el0_svc_naked: // compat entry point b.ne __sys_trace cmp wscno, wsc_nr // check upper syscall limit b.hs ni_sys + mask_nospec64 xscno, xsc_nr, x19 // enforce bounds for syscall number ldr x16, [stbl, xscno, lsl #3] // address in the syscall table blr x16 // call sys_* routine b ret_fast_syscall |