From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A74DC433B4 for ; Tue, 6 Apr 2021 12:01:32 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35AE0613BD for ; Tue, 6 Apr 2021 12:01:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35AE0613BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lg8aXpdDxMezh3PDQm+GdfK+x5YpfyPhnu41qaaqrSw=; b=Ofm6Gid6nEVlG/qvsuU1ayDDK BfK6DyKBZheIYm5hWnHEdrl/XUaR/7Nau2xQa/kWFaV9jCGcJ1CffrpEd3PJTNbxA7bcXh7ODXzSi xTYkyxVAbBb24IHnB/XcRltY7kDjlpH4Xj4xt0uabPkoDFvpyjO0ivlxzvt7cdOZUM78PWeCD9ruo /TcOgMszTf38oLQuJZWxpR3+LV7iPAwfGr+vhsEUrxvVnWgFP2CjHPpuj75tXB+AtP9Sz8l77Vljy u57I+SiwPm0mtMOhJvazcMkqGerqcd6xa99s49cZ+dCmktmPR0KrLmaB5WMWlXlV0AzkeVPsPavWX gfzUks/hQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTkMe-002TlY-62; Tue, 06 Apr 2021 11:59:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTkM1-002Tbf-CQ for linux-arm-kernel@lists.infradead.org; Tue, 06 Apr 2021 11:58:49 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0742012FC; Tue, 6 Apr 2021 04:58:44 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2DF273F73D; Tue, 6 Apr 2021 04:58:38 -0700 (PDT) Date: Tue, 6 Apr 2021 12:58:36 +0100 From: Mark Rutland To: Sami Tolvanen Cc: Kees Cook , Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , "Paul E. McKenney" , Christoph Hellwig , Peter Zijlstra , Sedat Dilek , Catalin Marinas , bpf@vger.kernel.org, linux-hardening@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH v5 16/18] arm64: ftrace: use function_nocfi for ftrace_call Message-ID: <20210406115836.GF96480@C02TD0UTHF1T.local> References: <20210401233216.2540591-1-samitolvanen@google.com> <20210401233216.2540591-17-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210401233216.2540591-17-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210406_125846_266433_19038E1D X-CRM114-Status: GOOD ( 17.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 01, 2021 at 04:32:14PM -0700, Sami Tolvanen wrote: > With CONFIG_CFI_CLANG, the compiler replaces function pointers with > jump table addresses, which breaks dynamic ftrace as the address of > ftrace_call is replaced with the address of ftrace_call.cfi_jt. Use > function_nocfi() to get the address of the actual function instead. > > Suggested-by: Ben Dai > Signed-off-by: Sami Tolvanen > --- > arch/arm64/kernel/ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c > index 86a5cf9bc19a..b5d3ddaf69d9 100644 > --- a/arch/arm64/kernel/ftrace.c > +++ b/arch/arm64/kernel/ftrace.c > @@ -55,7 +55,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func) > unsigned long pc; > u32 new; > > - pc = (unsigned long)&ftrace_call; > + pc = (unsigned long)function_nocfi(ftrace_call); Acked-by: Mark Rutland Thanks, Mark. > new = aarch64_insn_gen_branch_imm(pc, (unsigned long)func, > AARCH64_INSN_BRANCH_LINK); > > -- > 2.31.0.208.g409f899ff0-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel