Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp759ybg; Fri, 25 Oct 2019 15:31:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKCEyifyRymebXOUSeTi5h/TccHtXU4Sv01BXFKMyjHoGcbhnhKY0Esx5cTolZxyOr7aMF X-Received: by 2002:a17:906:5292:: with SMTP id c18mr5714102ejm.129.1572042700305; Fri, 25 Oct 2019 15:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572042700; cv=none; d=google.com; s=arc-20160816; b=nL5XAKyBiY/hf71SKK9UmLGVOfsRG2ja9LSeZ27brWXgEaIT79QLdPvDPZa2+VKRnb vf24VbEUCGPneJ9QesQLGpg9dIDKwn2kIGxi4znZ2iHb9awjiRW/2V6gd+o3VvboQjAE wsa+Osov9GrLZcYR+RvGFV8U3CxDkDprZUgxKd9tpPe9GoHam5fPnF1Ecjtv81CwZP1V j30/r7LTO1bJmiuKR8UnvPgCw3w2YB3CreEEOTx+y0EiuH4V0T6SKujsYjEEDfPFEZ8x 4xx/WqiUOxwLo9yE3Oac7jUeFuI9w6A3NfXsxutZ9nmWtqq9JRWpcS5C+MJ9CFOVMyKj h2ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=sXvBK/DxujYa5hNQB9NdA4NdQf1Nf+jfc7q90aVQWtE=; b=j5S1SglIsV8Uddo4y141XvbMddvo+diDbqFPF/dizYgXxY5uSDl7i2Fp60PKlEXo5F 5cdoxRyfMdbTBlFznXiNR+qJS+DCj1z2Yi/2z7U4P+5hN+cYtTiJt4XUujgaL+an+4hE qncZsOjWiBAljq+vMAH5BZF6DawNDBPeKh2o/c0vuVrzYBqgzI3OSchywugo41Be20wD CSNyuD31GwgYVY2kj8LHYtJI42pHV3zW92D0DE9iqVo0FPcCXUMxXM3Bg6ThtLGv9EJ+ PrBvDxAELzAuClbi/RAxfrNbJA1pP9qXjFadRMNZy/T8b/QDKDr0sSdGs5EMDgr5wcEb KQAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fy19si2128511ejb.239.2019.10.25.15.31.17; Fri, 25 Oct 2019 15:31:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410071AbfJYLDS (ORCPT + 99 others); Fri, 25 Oct 2019 07:03:18 -0400 Received: from foss.arm.com ([217.140.110.172]:39020 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410033AbfJYLDS (ORCPT ); Fri, 25 Oct 2019 07:03:18 -0400 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 EA68E1FB; Fri, 25 Oct 2019 04:03:17 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CB6B83F6C4; Fri, 25 Oct 2019 04:03:15 -0700 (PDT) Date: Fri, 25 Oct 2019 12:03:13 +0100 From: Mark Rutland To: samitolvanen@google.com Cc: Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Dave Martin , Kees Cook , Laura Abbott , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 09/17] arm64: disable function graph tracing with SCS Message-ID: <20191025110313.GE40270@lakrids.cambridge.arm.com> References: <20191018161033.261971-1-samitolvanen@google.com> <20191024225132.13410-1-samitolvanen@google.com> <20191024225132.13410-10-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191024225132.13410-10-samitolvanen@google.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 24, 2019 at 03:51:24PM -0700, samitolvanen@google.com wrote: > With CONFIG_FUNCTION_GRAPH_TRACER, function return addresses are > modified in ftrace_graph_caller and prepare_ftrace_return to redirect > control flow to ftrace_return_to_handler. This is incompatible with > SCS. I'm guessing it's difficult to always figure out the SCS slot for an instrumented callsite unless we pass this explicitly from the ftrace entry code, so we'd probably have to change some common infrastructure for that. We have a similar issue with pointer authentication, and we're solving that with -fpatchable-function-entry, which allows us to hook the callsite before it does anything with the return address. IIUC we could use the same mechanism here (and avoid introducing a third). Are there plans to implement -fpatchable-function-entry on the clang side? Thanks, Mark. > > Signed-off-by: Sami Tolvanen > --- > arch/arm64/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 3f047afb982c..8cda176dad9a 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -148,7 +148,7 @@ config ARM64 > select HAVE_FTRACE_MCOUNT_RECORD > select HAVE_FUNCTION_TRACER > select HAVE_FUNCTION_ERROR_INJECTION > - select HAVE_FUNCTION_GRAPH_TRACER > + select HAVE_FUNCTION_GRAPH_TRACER if !SHADOW_CALL_STACK > select HAVE_GCC_PLUGINS > select HAVE_HW_BREAKPOINT if PERF_EVENTS > select HAVE_IRQ_TIME_ACCOUNTING > -- > 2.24.0.rc0.303.g954a862665-goog >