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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FE44C433F5 for ; Mon, 11 Oct 2021 12:54:05 +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 5CED7604DB for ; Mon, 11 Oct 2021 12:54:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5CED7604DB 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=V8ZaYwnGIYflllv13lKlCZJEJn8jsyyLVr/JCZcIG18=; b=ds6RYMW+1QdaeI 1OEP0hOBy+Hhi1hFIMXNvS08ZGjfYYtiHn7C+h6jglbp7CyntCzN0fw9/GWN/twK3a82KSCkwRqda 4/lYcPya1SesR9wQVn7FZxciCBbWd4xOLrXmrJDD69Ds8YBpkkds1gKrQWJ/A28hfQi4J0/VD2B9v qOGEiy0yJEVcYNP0sWDGi6Z7Qh15mXc47TqxQOMh7SHS/tikHMuRGZMsTGJVP0/hAfoARGKgUzSFN CGvRRmq42A8B12rQ3y9Qq6QrbIJOcxNqLSN4IqU6YOE11fm/dYga0B9LG0reOPqzAAD/6Xr1aKLoo hHsV3SWAyPBQpQ8BEZ9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZumO-009PkR-9M; Mon, 11 Oct 2021 12:51:44 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZumK-009PjW-UC for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 12:51:42 +0000 Received: by mail-pl1-x632.google.com with SMTP id x4so11286943pln.5 for ; Mon, 11 Oct 2021 05:51:39 -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=TfUZzwiLi5+SzReakJZopKh7Hr/7mT1olQHJVB0Sy/c=; b=XWik9ZjFOk/4LLMhsIRzlkjZAquZ5m7H8NaN5TMttt2vSZ3pq5pP3OZSf38j4YwHdI gjCeW9qYzgChbzQJD9+vA0aSFs6YXFrhxrd3rqnlmxR1GizzkXt+sM6zVBqjusLxYRlr oFCzJgZAGDR9YcUHlYmAWE+g+tAvAYJLMaPtkzylAJKuHQx0t9Nuf4vsRqWEWd36cLnk XPHOioohb1gNaWDDI5dDzjmVakYn8I6bGgwP5i3OdDKygO0wd1y5RikGTYGx9HuCBdMB EBIUYsbYxRCw9vpRoOvuU0Q8E7rX/J7r0WSXj9YUU4GRvKs5uaKHa3k30jMKryt0a4iH 0BQA== 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=TfUZzwiLi5+SzReakJZopKh7Hr/7mT1olQHJVB0Sy/c=; b=Rvsgl4JznF202dsXzDeM1PSmoLox6vDq0Fl239YiG3D7g8crjhaJl9esRG8TRl3GrD 6xjE+REEE6Yd0wUrFALJlC0vmAdt04PNjs23Cq24a6bCP9uxskTbrMBx1bgLEhBbgC9q aK3gWXWRAilow6NAritlHd9ibbI+rvfuExLM/z1h4Q2mxpr0R07IupxLShvbv6Nnftz1 s2jBhc8hi/rAp1T0BSP5z9Nv86cTMAobRpHleDDRgC9uq5IyFcpTzR/Be6O74soHNPh6 xYpxf/pwpYu/phNkcMCCjt+wx4ioGA6s/Uy/pt8ymJOV1ADodUC+DdqkGb0FM+r6dH51 CRMg== X-Gm-Message-State: AOAM533vklyLKFFQCPYoKv6bepzwWZZne7SdntRdXJa0W4r7+w8eHQqc ylUvISQs2iubxtAtTA26zbjy+g== X-Google-Smtp-Source: ABdhPJxFZ3ep63oEgxhyrB2JHoxuFpBAlBufBPTktok4aRDzrFgs5FckkIkLnYlFxBevJSyHzNRdhw== X-Received: by 2002:a17:90a:b78d:: with SMTP id m13mr30587060pjr.17.1633956699007; Mon, 11 Oct 2021 05:51:39 -0700 (PDT) Received: from localhost.localdomain ([223.178.212.208]) by smtp.gmail.com with ESMTPSA id y18sm7734194pff.184.2021.10.11.05.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 05:51:38 -0700 (PDT) From: Sumit Garg To: will@kernel.org, catalin.marinas@arm.com Cc: linux-arm-kernel@lists.infradead.org, rostedt@goodmis.org, mingo@redhat.com, samitolvanen@google.com, ben.dai@unisoc.com, mark.rutland@arm.com, nathan@kernel.org, keescook@chromium.org, ndesaulniers@google.com, daniel.thompson@linaro.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Sumit Garg Subject: [PATCH v3] arm64: ftrace: use function_nocfi for _mcount as well Date: Mon, 11 Oct 2021 18:20:59 +0530 Message-Id: <20211011125059.3378646-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-20211011_055141_006714_615556EA X-CRM114-Status: GOOD ( 13.90 ) 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 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. With mainline, this won't be a problem since by default CONFIG_DYNAMIC_FTRACE_WITH_REGS=y with Clang >= 10 as it supports -fpatchable-function-entry and CFI requires Clang 12 but for consistency we should add function_nocfi() for _mcount as well. Signed-off-by: Sumit Garg Acked-by: Mark Rutland Reviewed-by: Sami Tolvanen --- Changes in v3: - Droped fixes tag as it isn't critical. - Modified commit description in order to make this change for consistency. - Picked up Sami's review tag. Changes in v2: - Added fixes tag. - Extended commit description. - Picked up Mark's ack. 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 */ -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel