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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 A1722C352BE for ; Fri, 17 Apr 2020 15:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EA9D20857 for ; Fri, 17 Apr 2020 15:27:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PsghyDdO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729099AbgDQP11 (ORCPT ); Fri, 17 Apr 2020 11:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728542AbgDQP11 (ORCPT ); Fri, 17 Apr 2020 11:27:27 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C298C061A0C for ; Fri, 17 Apr 2020 08:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Yqtf2Cr9VCQpUS0GldnV7JK60DFB1BUHRTQDFzdrac0=; b=PsghyDdOxbKQz5ubAHKB+S1KQ1 4WGvoF0mQLZg7hUM7fMf8NP5ldMyeI3yCYJx6RLRak2X5e+/Q9xDAZRUP0QQU9W1n2QQPTfGOggc1 7CqiU9OJaaxVW+QPFi4Dyfve2Njq9xOAD+9mHA8/u+KFHkSdq1bH9aDEzeFKrnuisXCs6Ycf4toKF 88xJh20yh3d3gSYbH10L6SP20nwScbLCX/6eZFXn2BOF4GtsdEOGKzF6nUJuak+7+vX9OIjbkXrE0 DUV9lrpFh2d5OVlZ+pHRjXK3TL/SFRewlLfAK1go3ND7b0enqZh42kTCvyg04auwwc3DAZLklUu69 Lr0cyH0w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPStE-0008Sz-Ht; Fri, 17 Apr 2020 15:26:48 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DF502304E03; Fri, 17 Apr 2020 17:26:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BFFE02B12192B; Fri, 17 Apr 2020 17:26:45 +0200 (CEST) Date: Fri, 17 Apr 2020 17:26:45 +0200 From: Peter Zijlstra To: Mark Rutland Cc: Sami Tolvanen , Will Deacon , Catalin Marinas , James Morse , Steven Rostedt , Ard Biesheuvel , Masahiro Yamada , Michal Marek , Ingo Molnar , Juri Lelli , Vincent Guittot , Dave Martin , Kees Cook , Laura Abbott , Marc Zyngier , Masami Hiramatsu , Nick Desaulniers , Jann Horn , Miguel Ojeda , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 04/12] scs: disable when function graph tracing is enabled Message-ID: <20200417152645.GH20730@hirez.programming.kicks-ass.net> References: <20191018161033.261971-1-samitolvanen@google.com> <20200416161245.148813-1-samitolvanen@google.com> <20200416161245.148813-5-samitolvanen@google.com> <20200417100039.GS20730@hirez.programming.kicks-ass.net> <20200417144620.GA9529@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200417144620.GA9529@lakrids.cambridge.arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 17, 2020 at 03:46:21PM +0100, Mark Rutland wrote: > > > diff --git a/arch/Kconfig b/arch/Kconfig > > > index 691a552c2cc3..c53cb9025ad2 100644 > > > --- a/arch/Kconfig > > > +++ b/arch/Kconfig > > > @@ -542,6 +542,7 @@ config ARCH_SUPPORTS_SHADOW_CALL_STACK > > > > > > config SHADOW_CALL_STACK > > > bool "Clang Shadow Call Stack" > > > + depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER > > > depends on ARCH_SUPPORTS_SHADOW_CALL_STACK > > > help > > > This option enables Clang's Shadow Call Stack, which uses a > > > AFAICT you also need to kill KRETPROBES, which plays similar games. > > Hmm... how does KREPROBES work? If you can only mess with the return > address when probing the first instruction in the function, it'll just > work for SCS or pointer authentication, as the LR is used at that > instant. If KRETPROBES tries to mess with the return address elsewhere > it'd be broken today... To be fair, I've not looked at the arm64 implementation. x86 does gross things like ftrace does. On x86 ftrace_graph and kretprobe also can't be on at the same time for the same function, there's some yuck around there. Rostedt was recently talking about cleaning some of that up. But if kretprobe can work on arm64, then ftrace_graph can too, but I think that links back to what you said earlier, you didn't want more ftrace variants or something. > > And doesn't BPF also do stuff like this? > > Can BPF mess with return addresses now!? At least on x86 I think it does. But what do I know, I can't operate that stuff. Rostedt might know. 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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 9A1A1C2D0EF for ; Fri, 17 Apr 2020 15:27:04 +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 6DC9620857 for ; Fri, 17 Apr 2020 15:27:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sVuW68rV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DC9620857 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=UqaTAXd7u4jktSkA3NEIfXHlfGWs6tDLd3BRozTEGcw=; b=sVuW68rVMIWAju kze2BMpbGoZ+S+XTMlcMQuVopncvd3XlKjpH7UGSKHSPhu5OYlDo/74l+Dl2Ewuqdh63C0CNPsAYw jI9X7uoE0hihIuN8ZSEol61W642i+4O/Yb6rXalZ5ETT7uxmWs4uOn6YT5M3y5Fwm3HqqYahXVlKj 0QSZyup7/SAhOYHn4y/F9/mtuuD+suDvzGDa2YtHcukYdWlWaHx++WRLb988vITb5GocEMv28Nioc CSiw63y1N8CL3bEPDEDWcnO4Ev7Y2shbSFhEtJaHq/8dUT8z63lxzvp3nMz0r2Q3Z79wI8qdll30M ImC41xpxruh/bLXoAjbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPStS-0000Fh-UU; Fri, 17 Apr 2020 15:27:02 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPStE-0008Sz-Ht; Fri, 17 Apr 2020 15:26:48 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DF502304E03; Fri, 17 Apr 2020 17:26:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BFFE02B12192B; Fri, 17 Apr 2020 17:26:45 +0200 (CEST) Date: Fri, 17 Apr 2020 17:26:45 +0200 From: Peter Zijlstra To: Mark Rutland Subject: Re: [PATCH v11 04/12] scs: disable when function graph tracing is enabled Message-ID: <20200417152645.GH20730@hirez.programming.kicks-ass.net> References: <20191018161033.261971-1-samitolvanen@google.com> <20200416161245.148813-1-samitolvanen@google.com> <20200416161245.148813-5-samitolvanen@google.com> <20200417100039.GS20730@hirez.programming.kicks-ass.net> <20200417144620.GA9529@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200417144620.GA9529@lakrids.cambridge.arm.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , kernel-hardening@lists.openwall.com, Catalin Marinas , Will Deacon , Marc Zyngier , Masahiro Yamada , clang-built-linux@googlegroups.com, Ingo Molnar , Sami Tolvanen , Laura Abbott , Dave Martin , Kees Cook , Jann Horn , Steven Rostedt , linux-arm-kernel@lists.infradead.org, Michal Marek , Ard Biesheuvel , Nick Desaulniers , linux-kernel@vger.kernel.org, Miguel Ojeda , James Morse , Masami Hiramatsu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 17, 2020 at 03:46:21PM +0100, Mark Rutland wrote: > > > diff --git a/arch/Kconfig b/arch/Kconfig > > > index 691a552c2cc3..c53cb9025ad2 100644 > > > --- a/arch/Kconfig > > > +++ b/arch/Kconfig > > > @@ -542,6 +542,7 @@ config ARCH_SUPPORTS_SHADOW_CALL_STACK > > > > > > config SHADOW_CALL_STACK > > > bool "Clang Shadow Call Stack" > > > + depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER > > > depends on ARCH_SUPPORTS_SHADOW_CALL_STACK > > > help > > > This option enables Clang's Shadow Call Stack, which uses a > > > AFAICT you also need to kill KRETPROBES, which plays similar games. > > Hmm... how does KREPROBES work? If you can only mess with the return > address when probing the first instruction in the function, it'll just > work for SCS or pointer authentication, as the LR is used at that > instant. If KRETPROBES tries to mess with the return address elsewhere > it'd be broken today... To be fair, I've not looked at the arm64 implementation. x86 does gross things like ftrace does. On x86 ftrace_graph and kretprobe also can't be on at the same time for the same function, there's some yuck around there. Rostedt was recently talking about cleaning some of that up. But if kretprobe can work on arm64, then ftrace_graph can too, but I think that links back to what you said earlier, you didn't want more ftrace variants or something. > > And doesn't BPF also do stuff like this? > > Can BPF mess with return addresses now!? At least on x86 I think it does. But what do I know, I can't operate that stuff. Rostedt might know. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel