OSDN Git Service

arm64: entry: Ensure branch through syscall table is bounded under speculation
authorMark Rutland <mark.rutland@arm.com>
Thu, 12 Apr 2018 11:11:02 +0000 (12:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Apr 2018 06:20:43 +0000 (08:20 +0200)
commitf3ed64a6273ebdc1ddf22262c4e5f724688b7393
tree085838e2fc17e28698d5326cf34cb7f5726fba44
parent891bea9528a6e48312ac16111a134442ee963726
arm64: entry: Ensure branch through syscall table is bounded under speculation

From: Will Deacon <will.deacon@arm.com>

commit 6314d90e64936c584f300a52ef173603fb2461b5 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>
[v4.9: use existing scno & sc_nr definitions]
Signed-off-by: Mark Rutland <mark.rutland@arm.com> [v4.9 backport]
Tested-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/assembler.h
arch/arm64/kernel/entry.S