[PATCH 20/38] arm64: probes: Reject stepping over ALLINT
Jinjie Ruan
ruanjinjie at huawei.com
Wed Sep 16 01:53:58 PDT 2026
在 2026/9/14 18:20, Vladimir Murzin 写道:
> ALLINT instructions are not safe for probing. Both the register and
> immediate forms of MSR for ALLINT are currently rejected because they
> match aarch64_insn_is_msr_{imm,reg}(). However, MRS instructions
> accessing ALLINT need to be rejected explicitly.
>
> Signed-off-by: Vladimir Murzin <vladimir.murzin at arm.com>
> ---
> arch/arm64/include/asm/insn.h | 1 +
> arch/arm64/kernel/probes/decode-insn.c | 11 +++++++----
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
> index 1ce75a442638..0a81b5feb2ed 100644
> --- a/arch/arm64/include/asm/insn.h
> +++ b/arch/arm64/include/asm/insn.h
> @@ -118,6 +118,7 @@ enum aarch64_insn_special_register {
> AARCH64_INSN_SPCLREG_SP_EL0 = 0xC208,
> AARCH64_INSN_SPCLREG_SPSEL = 0xC210,
> AARCH64_INSN_SPCLREG_CURRENTEL = 0xC212,
> + AARCH64_INSN_SPCLREG_ALLINT = 0xC218,
> AARCH64_INSN_SPCLREG_DAIF = 0xDA11,
> AARCH64_INSN_SPCLREG_NZCV = 0xDA10,
> AARCH64_INSN_SPCLREG_FPCR = 0xDA20,
> diff --git a/arch/arm64/kernel/probes/decode-insn.c b/arch/arm64/kernel/probes/decode-insn.c
> index 4137cc5ef031..a98d9d30fb4a 100644
> --- a/arch/arm64/kernel/probes/decode-insn.c
> +++ b/arch/arm64/kernel/probes/decode-insn.c
> @@ -36,11 +36,14 @@ static bool __kprobes aarch64_insn_is_steppable(u32 insn)
> /*
> * The MRS instruction may not return a correct value when
> * executing in the single-stepping environment. We do make one
> - * exception, for reading the DAIF bits.
> + * exception, for reading the DAIF and ALLINT bits.
> */
> - if (aarch64_insn_is_mrs(insn))
> - return aarch64_insn_extract_system_reg(insn)
> - != AARCH64_INSN_SPCLREG_DAIF;
> + if (aarch64_insn_is_mrs(insn)) {
> + u32 sysreg = aarch64_insn_extract_system_reg(insn);
> +
> + return (sysreg != AARCH64_INSN_SPCLREG_DAIF) &&
> + (sysreg != AARCH64_INSN_SPCLREG_ALLINT);
LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie at huawei.com>
> + }
>
> /*
> * The HINT instruction is steppable only if it is in whitelist
More information about the linux-arm-kernel
mailing list