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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 30034C2BB1D for ; Fri, 17 Apr 2020 23:19:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4DD6221EA for ; Fri, 17 Apr 2020 23:19:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O3KHKU0k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727955AbgDQXTr (ORCPT ); Fri, 17 Apr 2020 19:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbgDQXTq (ORCPT ); Fri, 17 Apr 2020 19:19:46 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E29AC061A0C for ; Fri, 17 Apr 2020 16:19:45 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id t16so1511073plo.7 for ; Fri, 17 Apr 2020 16:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eZN/WzOYxhMTyXM1n4Hh0KjKOonGokmtIz9JOOeY5Vg=; b=O3KHKU0k3dInIICnUfIysdWxzBUY+XUTDdijeLAiDhdFnA8PBKuhSQpvogX9RxTlrx kTA/e34YdRHp6WhC8hlBrw/wHMQiAsB5baO1CXMAOyQ8ifvtNvMIs4s159Dofwdzj2+m xmOBe5OL0lfhhbpZGbUM2gQ8jnidHc+1xlY/fOe26n2CzbTPuNkpasriAoOqZ07DoWfI xFKb+gMgSzaUOzRj2fy3suByEC/htSW+YF9Iyf3GrQ2l41nZaLnZ/2iMxm16wj+3V8iu ZKOI3sDWFzGtyd0JvAiuvKjTy/lgLrzbwdLv8B0BzgGvUDUm8aMYaJdtnU/2KyLI1DQe j/UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eZN/WzOYxhMTyXM1n4Hh0KjKOonGokmtIz9JOOeY5Vg=; b=WKB6AWuFsCeyeafBFb831W29dixrLPUR4SWLfSP2FukDIwJSUSIbQKb5KV14cb38pj VgRsdNOKKA1TKVhlww8EyEcONdlFhaRwZDXB6Hhu/Unp8nxZ6flyWJG5R3kJdFIQzhgA XltG/RkoV0YN/Zhb1BIhp8OPiTMSta1HtamWoZqyUhFsJCeEwu+KEE5Viqg3dxtdUNv3 I79//91SSQxzZC0pUazi3eutrZGuT3QHC7Pb72RicHZ9mYAf/RL5kkeMMBrc6CummRIp VoTyOYZ6CO2q5C65ZJxdt5SNGxlJmRTaveWqDxbdS1kDGydHZp4FFDoLPPmIflwZxs2Q DZJw== X-Gm-Message-State: AGi0PuaFcGsY7sCNkcopVuLfwheW/U2KqMHraETi6ougzsOXOuSby7I2 bnitjmqS5ZzBZ9XTn6GhQj2Brg== X-Google-Smtp-Source: APiQypI+0JpweCt3GR455upZub8Lrjz/gzQ722UCFMq+C5APeD7it5UYnLinXZ4wa5mxzmtEsNYr0Q== X-Received: by 2002:a17:902:bd09:: with SMTP id p9mr6170885pls.25.1587165584157; Fri, 17 Apr 2020 16:19:44 -0700 (PDT) Received: from google.com ([2620:15c:201:2:ce90:ab18:83b0:619]) by smtp.gmail.com with ESMTPSA id y123sm20188542pfb.13.2020.04.17.16.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 16:19:42 -0700 (PDT) Date: Fri, 17 Apr 2020 16:19:37 -0700 From: Sami Tolvanen To: Mark Rutland Cc: Peter Zijlstra , 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: <20200417231937.GA214321@google.com> 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> <20200417152645.GH20730@hirez.programming.kicks-ass.net> <20200417154613.GB9529@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200417154613.GB9529@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 04:46:14PM +0100, Mark Rutland wrote: > If KRETPROBES works by messing with the LR at the instnat the function > is entered, that should work similarly. If it works by replacing the > RET it should also work out since any pauth/SCS work will have been > undone by that point. If it attempts to mess with the return address in > the middle of a function then it's not reliable today. I did initially have a patch to disable kretprobes (until v5), but as Mark pointed out back then, the return address is modified before it gets pushed to the shadow stack, so there was no conflict with SCS. I confirmed this on arm64, but haven't looked at other architectures. Sami 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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, 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 B816EC2BB1D for ; Fri, 17 Apr 2020 23:19:54 +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 80F172223D for ; Fri, 17 Apr 2020 23:19:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="APH/VOrV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="O3KHKU0k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80F172223D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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=3amlUKYeGgWGR6htbCV5YdypkovG9E0V9YXnV0g0PlU=; b=APH/VOrVQP1O6p kFS7O0e5XT4oPgOX/OKl5cciVQoqjYAxiu5AO5vuzwjT49VEqI+1o/7JMLB29Cw4K7q8ikdKvRCwu tfiaj6CTqXfk9l6GqjCPsRRJM1YhngiMQyhDAxqMJG/poVAKGvGaVC/Zcn9gK6lmihQv4Gtygaoo9 Jy4Q/xfGaRapxsTHpL3a/FBKOkPe0VhZ6X780cPIwJYKcqPHYlFRERQQp3/li6oWlMGTRxfirTn51 y6jTdVJIyq4dd5cIQN9HDAiuvOSXaEfDwg2sIUCOCsL0h9PFqvsGBVG3lzK/9yH5MHPVTHvVTq//P cnCUIxyf4xeo4ujYYeHQ==; 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 1jPaH2-0007Io-TO; Fri, 17 Apr 2020 23:19:52 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPaH0-0007Hi-BY for linux-arm-kernel@lists.infradead.org; Fri, 17 Apr 2020 23:19:51 +0000 Received: by mail-pl1-x644.google.com with SMTP id y22so1519108pll.4 for ; Fri, 17 Apr 2020 16:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eZN/WzOYxhMTyXM1n4Hh0KjKOonGokmtIz9JOOeY5Vg=; b=O3KHKU0k3dInIICnUfIysdWxzBUY+XUTDdijeLAiDhdFnA8PBKuhSQpvogX9RxTlrx kTA/e34YdRHp6WhC8hlBrw/wHMQiAsB5baO1CXMAOyQ8ifvtNvMIs4s159Dofwdzj2+m xmOBe5OL0lfhhbpZGbUM2gQ8jnidHc+1xlY/fOe26n2CzbTPuNkpasriAoOqZ07DoWfI xFKb+gMgSzaUOzRj2fy3suByEC/htSW+YF9Iyf3GrQ2l41nZaLnZ/2iMxm16wj+3V8iu ZKOI3sDWFzGtyd0JvAiuvKjTy/lgLrzbwdLv8B0BzgGvUDUm8aMYaJdtnU/2KyLI1DQe j/UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eZN/WzOYxhMTyXM1n4Hh0KjKOonGokmtIz9JOOeY5Vg=; b=YGerrSWqlbhJ0gql6I0/2CvyWR7A5z97IIPIdahpbKrcmiNJNweqVpAyrBq9uiKYok 9Z+gm1m/Cfuc9o3Kwvis27wNPH0NUFYyoWjU7kA+2bv8RV3BlHypvUzYp1VFsvO5IBPQ +Zn1NdRMRlHTHsJtUI7C5ZnboeEzSMZraGvqVoV+6bB8e5hfSTomNF4nIGF1tizIH1l2 delqbAmEY8VY1+4BQMUPJT38skDD28wA0KoO45kRRRNMbLmBVnTa3RJ9+z57+D5d+5yE /hXjkH/YQ6pe8bm3WiwvyDIwRxlON2uMhC9OAY/92KRSApi9beCXmbO6k6cKNR6kojhl nofQ== X-Gm-Message-State: AGi0Puai4pZ3t8DEXbw8t1Cxhyt73YhLS6ARtre5+X7SB87oI+2wNRpW NGFbBjzqzlKLKAIHLXK6Yn0FcQ== X-Google-Smtp-Source: APiQypI+0JpweCt3GR455upZub8Lrjz/gzQ722UCFMq+C5APeD7it5UYnLinXZ4wa5mxzmtEsNYr0Q== X-Received: by 2002:a17:902:bd09:: with SMTP id p9mr6170885pls.25.1587165584157; Fri, 17 Apr 2020 16:19:44 -0700 (PDT) Received: from google.com ([2620:15c:201:2:ce90:ab18:83b0:619]) by smtp.gmail.com with ESMTPSA id y123sm20188542pfb.13.2020.04.17.16.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 16:19:42 -0700 (PDT) Date: Fri, 17 Apr 2020 16:19:37 -0700 From: Sami Tolvanen To: Mark Rutland Subject: Re: [PATCH v11 04/12] scs: disable when function graph tracing is enabled Message-ID: <20200417231937.GA214321@google.com> 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> <20200417152645.GH20730@hirez.programming.kicks-ass.net> <20200417154613.GB9529@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200417154613.GB9529@lakrids.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200417_161950_418038_0C902864 X-CRM114-Status: GOOD ( 12.22 ) 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, Peter Zijlstra , Catalin Marinas , Will Deacon , Marc Zyngier , Masahiro Yamada , clang-built-linux@googlegroups.com, Ingo Molnar , 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 04:46:14PM +0100, Mark Rutland wrote: > If KRETPROBES works by messing with the LR at the instnat the function > is entered, that should work similarly. If it works by replacing the > RET it should also work out since any pauth/SCS work will have been > undone by that point. If it attempts to mess with the return address in > the middle of a function then it's not reliable today. I did initially have a patch to disable kretprobes (until v5), but as Mark pointed out back then, the return address is modified before it gets pushed to the shadow stack, so there was no conflict with SCS. I confirmed this on arm64, but haven't looked at other architectures. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel