arm64: entry: Ensure branch through syscall table is bounded under speculation
authorWill Deacon <will.deacon@arm.com>
Mon, 5 Feb 2018 15:34:20 +0000 (15:34 +0000)
committerHaibo Chen <haibo.chen@nxp.com>
Thu, 12 Apr 2018 10:46:21 +0000 (18:46 +0800)
commit8bea10943af91a7c0b04e1cc8543eb2254ca337d
treebcc5f0b22dfaa7d35d82c645dd5ccb91945caa31
parent266967afdf932a543f29642d7767be8a03d84a9b
arm64: entry: Ensure branch through syscall table is bounded under speculation

commit 6314d90e6493 upstream.

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>
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/include/asm/assembler.h
arch/arm64/kernel/entry.S