Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3123722rwb; Mon, 15 Aug 2022 18:42:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR5OShr7uLPirrnr2iWhCoQWX3xJ+G+BHXPqSSxYQQo9cuhmRCLBPvdvqz5GZlHeHbhZf7N3 X-Received: by 2002:a63:9042:0:b0:41c:cdd4:ae66 with SMTP id a63-20020a639042000000b0041ccdd4ae66mr15673036pge.47.1660614175218; Mon, 15 Aug 2022 18:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614175; cv=none; d=google.com; s=arc-20160816; b=lfnxJrKjcLFH9wwE8EeBxkxu3IsZipmb93VrSvAVxuQI+Iwh6bJ1nsU+KEDRasypE4 E7DYN5x/1R1mKOCy8HIC3XAKp2yKU7e8eC8Je8eLQqBulxKIzukw//0S4FlOd63TXNpj oaSQuAvJet2fAc7qLDj+lSwGrF/KIexHjiQoyKmVHifPHHBU60bkVwaF4DSedNjCTnYA 2t/vG7lAkmRz2TLc8chRevdH6F9Xq3k+HE/bow4uHATWoNxFoOhhCtBYkZS050DRGSkh rHz4+52XNB04s1jC8vm7dvRsBVX3r/Tpq/I3Xx1GF3h/EmFrzdAy6Ex6BbA/bIhGULlf zoKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BrUev1Bsgg4LOig1wZnmfqfkw7+LH4SSzs3FNrOJVB0=; b=g1HyarIivuQYohes7W699tHyyYeo1TqietQf3Hc2kUBSp51IbwcbErLRs0mqeHAwcP ac4U84nMIYbPPkAIlZ0ckXkdKxC2W4Vj1YmDf6zq9vNJ9/PbKsuhzoaf+dw2tujq6j3z IZSEjoROG7abLj3cfpVulaKhd9pPC9JymMM0sGyclahm0irMAwWNutxy/knfgVnH6gba taK4b1mirjumAVSUc8GMpDYnwkJDkZc3FmDAKl+Z9/EIKNEpd+1LjFF7vY/fT3v15AM1 vaYrU8NnrRsiKdSR24+tF2iJK6qZL9W/jziFDNbwgSuH+pS4K0Ca42QIcMDE4wZLK75J 1jsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="B/ASc+n2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g67-20020a636b46000000b0041cea4daf7dsi12012365pgc.774.2022.08.15.18.42.43; Mon, 15 Aug 2022 18:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="B/ASc+n2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348684AbiHPBIR (ORCPT + 99 others); Mon, 15 Aug 2022 21:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245543AbiHPBDx (ORCPT ); Mon, 15 Aug 2022 21:03:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC49B9FA6; Mon, 15 Aug 2022 13:50:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6FD560FC4; Mon, 15 Aug 2022 20:50:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96CFFC433C1; Mon, 15 Aug 2022 20:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596620; bh=7IaIZ4zaLvoKeOMBxaLtJMWadgo5fogwtZKLGA8pVfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/ASc+n22QEf0YSW1m+dlI93UWDkEIjoxqpc6CJia19y4db1gWpbAd39FvaK4Qu08 Qm1cBH/DgRuMb6A0O2jBxZU9QywrLRlzkj47xMXOEuxmC1OLroOC7eynLz0AxXlWyy HjGBhcFnu2+0G06VVcF5axLOJRRfjbBxO9FInik0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Ondrej Mosnacek , "Naveen N. Rao" , Michael Ellerman Subject: [PATCH 5.19 1137/1157] powerpc64/ftrace: Fix ftrace for clang builds Date: Mon, 15 Aug 2022 20:08:13 +0200 Message-Id: <20220815180525.929733456@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naveen N. Rao 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@vger.kernel.org # v5.19+ Reported-by: Nick Desaulniers Reported-by: Ondrej Mosnacek Signed-off-by: Naveen N. Rao Tested-by: Ondrej Mosnacek Acked-by: Nick Desaulniers Signed-off-by: Michael Ellerman 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@linux.vnet.ibm.com Signed-off-by: Greg Kroah-Hartman --- 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;