Skip to content

Commit 49f6cba

Browse files
mrutland-armwildea01
authored andcommitted
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 <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Suzuki Poulose <suzuki.poulose@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent fa71531 commit 49f6cba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/arm64/kernel/traps.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,12 @@ asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
531531
return;
532532
}
533533

534-
force_signal_inject(SIGILL, ILL_ILLOPC, regs, 0);
534+
/*
535+
* New SYS instructions may previously have been undefined at EL0. Fall
536+
* back to our usual undefined instruction handler so that we handle
537+
* these consistently.
538+
*/
539+
do_undefinstr(regs);
535540
}
536541

537542
long compat_arm_syscall(struct pt_regs *regs);

0 commit comments

Comments
 (0)