From: Dave Martin Date: Mon, 16 Mar 2020 16:50:51 +0000 (+0000) Subject: arm64: BTI: Reset BTYPE when skipping emulated instructions X-Git-Tag: v5.8-rc1~213^2~2^2~16^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0537c4cd71e3c729c278c82f5b088460fb66fc33;p=thirdparty%2Flinux.git arm64: BTI: Reset BTYPE when skipping emulated instructions Since normal execution of any non-branch instruction resets the PSTATE BTYPE field to 0, so do the same thing when emulating a trapped instruction. Branches don't trap directly, so we should never need to assign a non-zero value to BTYPE here. Signed-off-by: Mark Brown Signed-off-by: Dave Martin Signed-off-by: Catalin Marinas --- diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 3c986c8ca2041..10d6451b27761 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -340,6 +340,8 @@ void arm64_skip_faulting_instruction(struct pt_regs *regs, unsigned long size) if (compat_user_mode(regs)) advance_itstate(regs); + else + regs->pstate &= ~PSR_BTYPE_MASK; } static LIST_HEAD(undef_hook);