From: Mark Rutland Date: Fri, 27 Jan 2017 16:15:38 +0000 (+0000) Subject: arm64: handle sys and undef traps consistently X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=49f6cba617fef4bc097a291e0dfd028cc7073c52;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git arm64: handle sys and undef traps consistently If an EL0 instruction in the SYS class triggers an exception, do_sysintr looks for a sys64_hook matching the instruction, and if none is found, injects a SIGILL. This mirrors what we do for undefined instruction encodings in do_undefinstr, where we look for an undef_hook matching the instruction, and if none is found, inject a SIGILL. Over time, new SYS instruction encodings may be allocated. Prior to allocation, exceptions resulting from these would be handled by do_undefinstr, whereas after allocation these may be handled by do_sysintr. To ensure that we have consistent behaviour if and when this happens, it would be beneficial to have do_sysinstr fall back to do_undefinstr. Signed-off-by: Mark Rutland Acked-by: Catalin Marinas Reviewed-by: Suzuki Poulose Signed-off-by: Will Deacon --- diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 8187229eb802..7c3fc0634aa2 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -531,7 +531,12 @@ asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs) return; } - force_signal_inject(SIGILL, ILL_ILLOPC, regs, 0); + /* + * New SYS instructions may previously have been undefined at EL0. Fall + * back to our usual undefined instruction handler so that we handle + * these consistently. + */ + do_undefinstr(regs); } long compat_arm_syscall(struct pt_regs *regs);