This is a note to let you know that I've just added the patch titled arm64: armv8_deprecated: move aarch32 helper earlier to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: arm64-armv8_deprecated-move-aarch32-helper-earlier.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ruanjinjie@xxxxxxxxxx Wed Oct 11 12:07:51 2023 From: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Date: Wed, 11 Oct 2023 10:06:53 +0000 Subject: arm64: armv8_deprecated: move aarch32 helper earlier To: <catalin.marinas@xxxxxxx>, <will@xxxxxxxxxx>, <mark.rutland@xxxxxxx>, <broonie@xxxxxxxxxx>, <anshuman.khandual@xxxxxxx>, <alexandru.elisei@xxxxxxx>, <sashal@xxxxxxxxxx>, <maz@xxxxxxxxxx>, <gregkh@xxxxxxxxxxxxxxxxxxx>, <james.morse@xxxxxxx>, <pcc@xxxxxxxxxx>, <scott@xxxxxxxxxxxxxxxxxxxxxx>, <ebiederm@xxxxxxxxxxxx>, <haibinzhang@xxxxxxxxxxx>, <hewenliang4@xxxxxxxxxx>, <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, <stable@xxxxxxxxxx> Cc: <ruanjinjie@xxxxxxxxxx> Message-ID: <20231011100655.979626-14-ruanjinjie@xxxxxxxxxx> From: Mark Rutland <mark.rutland@xxxxxxx> commit 0c5f416219da3795dc8b33e5bb7865a6b3c4e55c upstream. Subsequent patches will rework the logic in armv8_deprecated.c. In preparation for subsequent changes, this patch moves some shared logic earlier in the file. This will make subsequent diffs simpler and easier to read. At the same time, drop the `__kprobes` annotation from aarch32_check_condition(), as this is only used for traps from compat userspace, and has no risk of recursion within kprobes. As this is the last kprobes annotation in armve8_deprecated.c, we no longer need to include <asm/kprobes.h>. Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Joey Gouly <joey.gouly@xxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221019144123.612388-9-mark.rutland@xxxxxxx Signed-off-by: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/arm64/kernel/armv8_deprecated.c | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -17,7 +17,6 @@ #include <asm/sysreg.h> #include <asm/system_misc.h> #include <asm/traps.h> -#include <asm/kprobes.h> #define CREATE_TRACE_POINTS #include "trace-events-emulation.h" @@ -52,6 +51,25 @@ struct insn_emulation { int max; }; +#define ARM_OPCODE_CONDTEST_FAIL 0 +#define ARM_OPCODE_CONDTEST_PASS 1 +#define ARM_OPCODE_CONDTEST_UNCOND 2 + +#define ARM_OPCODE_CONDITION_UNCOND 0xf + +static unsigned int aarch32_check_condition(u32 opcode, u32 psr) +{ + u32 cc_bits = opcode >> 28; + + if (cc_bits != ARM_OPCODE_CONDITION_UNCOND) { + if ((*aarch32_opcode_cond_checks[cc_bits])(psr)) + return ARM_OPCODE_CONDTEST_PASS; + else + return ARM_OPCODE_CONDTEST_FAIL; + } + return ARM_OPCODE_CONDTEST_UNCOND; +} + /* * Implement emulation of the SWP/SWPB instructions using load-exclusive and * store-exclusive. @@ -138,25 +156,6 @@ static int emulate_swpX(unsigned int add return res; } -#define ARM_OPCODE_CONDTEST_FAIL 0 -#define ARM_OPCODE_CONDTEST_PASS 1 -#define ARM_OPCODE_CONDTEST_UNCOND 2 - -#define ARM_OPCODE_CONDITION_UNCOND 0xf - -static unsigned int __kprobes aarch32_check_condition(u32 opcode, u32 psr) -{ - u32 cc_bits = opcode >> 28; - - if (cc_bits != ARM_OPCODE_CONDITION_UNCOND) { - if ((*aarch32_opcode_cond_checks[cc_bits])(psr)) - return ARM_OPCODE_CONDTEST_PASS; - else - return ARM_OPCODE_CONDTEST_FAIL; - } - return ARM_OPCODE_CONDTEST_UNCOND; -} - /* * swp_handler logs the id of calling process, dissects the instruction, sanity * checks the memory location, calls emulate_swpX for the actual operation and Patches currently in stable-queue which might be from ruanjinjie@xxxxxxxxxx are queue-5.15/arm64-factor-insn-read-out-of-call_undef_hook.patch queue-5.15/arm64-rework-el0-mrs-emulation.patch queue-5.15/arm64-die-pass-err-as-long.patch queue-5.15/arm64-armv8_deprecated-rework-deprected-instruction-handling.patch queue-5.15/arm64-armv8_deprecated-fix-unused-function-error.patch queue-5.15/arm64-armv8_deprecated-move-aarch32-helper-earlier.patch queue-5.15/arm64-consistently-pass-esr_elx-to-die.patch queue-5.15/arm64-factor-out-el1-ssbs-emulation-hook.patch queue-5.15/arm64-report-el1-undefs-better.patch queue-5.15/arm64-armv8_deprecated-fold-ops-into-insn_emulation.patch queue-5.15/arm64-rework-bti-exception-handling.patch queue-5.15/arm64-rework-fpac-exception-handling.patch queue-5.15/arm64-split-el0-el1-undef-handlers.patch queue-5.15/arm64-allow-kprobes-on-el0-handlers.patch queue-5.15/arm64-armv8_deprecated-move-emulation-functions.patch