This is a note to let you know that I've just added the patch titled powerpc64/ftrace: Fix ftrace for clang builds to the 5.19-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: powerpc64-ftrace-fix-ftrace-for-clang-builds.patch and it can be found in the queue-5.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From cb928ac192128c842f4c1cfc8b6780b95719d65f Mon Sep 17 00:00:00 2001 From: "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxxxxxxx> Date: Tue, 9 Aug 2022 15:29:07 +0530 Subject: powerpc64/ftrace: Fix ftrace for clang builds From: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx> commit cb928ac192128c842f4c1cfc8b6780b95719d65f upstream. Clang doesn't support -mprofile-kernel ABI, so guard the checks against CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version. Fixes: 23b44fc248f4 ("powerpc/ftrace: Make __ftrace_make_{nop/call}() common to PPC32 and PPC64") Cc: stable@xxxxxxxxxxxxxxx # v5.19+ Reported-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Reported-by: Ondrej Mosnacek <omosnacek@xxxxxxxxx> Signed-off-by: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx> Tested-by: Ondrej Mosnacek <omosnacek@xxxxxxxxx> Acked-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Link: https://github.com/llvm/llvm-project/issues/57031 Link: https://github.com/ClangBuiltLinux/linux/issues/1682 Link: https://lore.kernel.org/r/20220809095907.418764-1-naveen.n.rao@xxxxxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/powerpc/kernel/trace/ftrace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/powerpc/kernel/trace/ftrace.c +++ b/arch/powerpc/kernel/trace/ftrace.c @@ -392,11 +392,11 @@ int ftrace_make_nop(struct module *mod, */ static bool expected_nop_sequence(void *ip, ppc_inst_t op0, ppc_inst_t op1) { - if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1)) + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS)) + return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP())); + else return ppc_inst_equal(op0, ppc_inst(PPC_RAW_BRANCH(8))) && ppc_inst_equal(op1, ppc_inst(PPC_INST_LD_TOC)); - else - return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP())); } static int @@ -411,7 +411,7 @@ __ftrace_make_call(struct dyn_ftrace *re if (copy_inst_from_kernel_nofault(op, ip)) return -EFAULT; - if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && + if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && copy_inst_from_kernel_nofault(op + 1, ip + 4)) return -EFAULT; Patches currently in stable-queue which might be from naveen.n.rao@xxxxxxxxxxxxxxxxxx are queue-5.19/kexec_file-drop-weak-attribute-from-functions.patch queue-5.19/powerpc64-ftrace-fix-ftrace-for-clang-builds.patch