From patchwork Tue Oct 5 10:32:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 12536151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C5CC433F5 for ; Tue, 5 Oct 2021 10:34:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CACEE6124F for ; Tue, 5 Oct 2021 10:34:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CACEE6124F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mnCMtHIGS2rc08fVG/sAR4X6LR4tbvSG7relZx7TGCQ=; b=qqILGYCSf8WNGc B8xZvfsaG/j17oxKvmYGDMUH1QNs/sJpg9sr+Uk8bm7H3mivoKdAQjbIV0nMm14yao74RVW7IK3mh 4srv9GMH6tHJWofj87RixHWDTXZqOD5D+rTfA1t2yTHSpHXRNcN8y8/2zu1dzBXt6C2BdHzbew0wQ lENTLiQtUurFjnl0WIu749PZpDAeIqKkUc2JXsXNqFt3VNL3wkdNpvAkI3OIDExMUbqQZRZuNqhhQ 9iLkEz9J4hFRGSS3jwmO4N038kx6rYuY1oxXruqU0A/UzhuzZBsTlP5PH9zvwaADVWiCr6MS3dADi gcpaA9yAfGyTT86dJVCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXhkp-00A0Aj-7l; Tue, 05 Oct 2021 10:32:59 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXhkl-00A09d-HQ for linux-arm-kernel@lists.infradead.org; Tue, 05 Oct 2021 10:32:56 +0000 Received: by mail-pg1-x533.google.com with SMTP id m21so19309663pgu.13 for ; Tue, 05 Oct 2021 03:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0e/7+5SzXQlLpgEzunZbHUeI6qjzjZ1gfmuGHDew4tU=; b=RUzoPnosbqWC5sLgAzQZvUdX5QkKXIYSDStLRafwbiSwjDAzbVh0n78R1nwOSB/oPJ qtxROiWMbDXiFn9qqmMENe0iZmMnEvQYZ5ji3e8nhmoKDmO8GS7hSOoAXQG13ob78yZZ H6CR+Yvu/Q74Aw3WqZvSEJM68AZYSXTB/Xx5KOFqcjYADqM2OnFltIyOQ0lMJA6KiyJI SsC6Lvt7EJhtj6orghHUCvDBnfpVUJinA8z5lXOb5j1CIdUYasEGFrfRbbpnFdT6eJTF V3s7wA3/ugkn71nV/YMOl1bHdPwduqHZvcu1Qgbf8O9HGH3NhUXbXibzu5S3JhN+ayqk gjmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0e/7+5SzXQlLpgEzunZbHUeI6qjzjZ1gfmuGHDew4tU=; b=klEsqGxnc5KOXuohV7sAJKkVVuH1nwWLk346Tkncwe5bVcb2xPC8IHBsW+CiezZ5Kx S6Y0JsJ2Z7Mqa6hCu7U5oHGI/YjW9wSK2wD/+CjChCmTieq9o+dEDZ2Y5egXED8ZvrRU qyNmVOtTPug8A6jCmCCQG+g8kc1/ybvyJVml5/uci5nae/FtI4fQY4wIxPqJAzGIXTCs KWTmS80eZNQuRjlYOFtsQMsYnS9H39z6hxepd2k/wtlH7/0DOu4oHv4Gb8CNDnNDwaeC zETzWSQdXdLo2nfg85E8r9Z0qXQG4TwCTzOyj8JFvUCKAcVZIwVQr0gmTmUY7cd2aJDW 7noA== X-Gm-Message-State: AOAM531qAPb4ICXO6+zO4WlAOLygkCA1qJlNeSl7j6kVHJ/NJAimaYjM OF4EqXxP3vrBM4V+EAgg/PGeCFGUFIeeaTnx X-Google-Smtp-Source: ABdhPJwEfwXg2t1YeKsh5A7Ps3+TPUG5Trd060oPzJmzViQVLTbj0Y3kNNN2tK6cmP21KovOIuAVYw== X-Received: by 2002:aa7:8116:0:b0:44b:e0d1:25e9 with SMTP id b22-20020aa78116000000b0044be0d125e9mr31039841pfi.53.1633429969060; Tue, 05 Oct 2021 03:32:49 -0700 (PDT) Received: from localhost.localdomain ([223.178.212.101]) by smtp.gmail.com with ESMTPSA id s7sm12853639pgc.60.2021.10.05.03.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 03:32:48 -0700 (PDT) From: Sumit Garg To: linux-arm-kernel@lists.infradead.org Cc: rostedt@goodmis.org, mingo@redhat.com, catalin.marinas@arm.com, will@kernel.org, samitolvanen@google.com, ben.dai@unisoc.com, mark.rutland@arm.com, nathan@kernel.org, keescook@chromium.org, daniel.thompson@linaro.org, linux-kernel@vger.kernel.org, Sumit Garg Subject: [PATCH] arm64: ftrace: use function_nocfi for _mcount as well Date: Tue, 5 Oct 2021 16:02:08 +0530 Message-Id: <20211005103208.2763305-1-sumit.garg@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211005_033255_602516_5AE24CA4 X-CRM114-Status: GOOD ( 12.88 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 800618f955a9 ("arm64: ftrace: use function_nocfi for ftrace_call") only fixed address of ftrace_call but address of _mcount needs to be fixed as well. Use function_nocfi() to get the actual address of _mcount function as with CONFIG_CFI_CLANG, the compiler replaces function pointers with jump table addresses which breaks dynamic ftrace as the address of _mcount is replaced with the address of _mcount.cfi_jt. Signed-off-by: Sumit Garg Acked-by: Mark Rutland --- arch/arm64/include/asm/ftrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index 91fa4baa1a93..347b0cc68f07 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -15,7 +15,7 @@ #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #define ARCH_SUPPORTS_FTRACE_OPS 1 #else -#define MCOUNT_ADDR ((unsigned long)_mcount) +#define MCOUNT_ADDR ((unsigned long)function_nocfi(_mcount)) #endif /* The BL at the callsite's adjusted rec->ip */