Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1193720ybx; Tue, 5 Nov 2019 11:56:19 -0800 (PST) X-Google-Smtp-Source: APXvYqz/tvN7YXuYfsk9ZZHJScMW6tmLkO/eXCTU0rMXolbe/Sgv8W1z6N180j41PE4mpgpPRKGV X-Received: by 2002:a17:906:1611:: with SMTP id m17mr32058614ejd.281.1572983779813; Tue, 05 Nov 2019 11:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572983779; cv=none; d=google.com; s=arc-20160816; b=sIcyqhpZxUooaSXynFRAHZ9F2RDwAmUo/6Whf5SkuiRHNEQDzrOBU/TNQg+6YEOGJv 7nXA2N2OaXmkR97ajLZoyKL7/+J5CLKcKBxaeTGiSOA4pF8bUSHLrj2nEsC+PkQe2VVW Te1Dlv42qHABRIIvb3R9OBtrJDzyQiDArrzI3cTFrFK0hghwyULYXWHQxV7qDQAwmHaU 6fHg6kaxh10c6jmUbt5k1CnbajvgBmCDJEArMLoEfgkRkvryewTgT1AvQaInJ979Jpxx KAwhX8ZSQ480z6WYbz9xWEr+j3FQZi10iintYsZcrS5/d+Tb0kWC2cEMUDTQ2lsJw2FK K6Cg== 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=s5OAPJWJQvDqSUqcJwATukE31mcRm1uO5rU03nn4PnQ=; b=LEDL6dJk7miVji/9fJHBlPMz2oM8tZ8Qxm+VYdxwjyzuI9PemMjQy7khHsbjzd1Hdx fc/QjzTnAMQe3+Q3z/CVk/RJN6od/0iF6O1TK4gbLdScor2hfKGaL0FTKnU136xQ0Ovq PW3J69FN2Y9kp5EovzOIQ5J27kuoKEr3LhxtqLDenju8GkgMot7f2xPv1FaprHb3y+tO 4U66+YFsyaKquaEBNBNbk6oY3SlXS0mm2SCyhu6ilsSlIVRv7Hg4mmreAskAiLtT05w2 4SjSIy6GBm3pImLF7Gt+4dKeUjJuxm1gXmf28U6q49DZeTYSbndziNtEcr2zHLrv1pZg l48A== 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 u12si12554753eda.319.2019.11.05.11.55.56; Tue, 05 Nov 2019 11:56:19 -0800 (PST) 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 S1726697AbfKETy5 (ORCPT + 99 others); Tue, 5 Nov 2019 14:54:57 -0500 Received: from foss.arm.com ([217.140.110.172]:58000 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbfKETy5 (ORCPT ); Tue, 5 Nov 2019 14:54:57 -0500 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 8E02A7B9; Tue, 5 Nov 2019 11:54:56 -0800 (PST) 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 5E4523FBA1; Tue, 5 Nov 2019 01:15:53 -0800 (PST) Date: Tue, 5 Nov 2019 09:15:51 +0000 From: Mark Rutland To: Sami Tolvanen Cc: Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Dave Martin , Kees Cook , Laura Abbott , Marc Zyngier , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux , Kernel Hardening , linux-arm-kernel , LKML Subject: Re: [PATCH v4 11/17] arm64: disable function graph tracing with SCS Message-ID: <20191105091301.GB4743@lakrids.cambridge.arm.com> References: <20191018161033.261971-1-samitolvanen@google.com> <20191101221150.116536-1-samitolvanen@google.com> <20191101221150.116536-12-samitolvanen@google.com> <20191104171132.GB2024@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Nov 04, 2019 at 03:44:39PM -0800, Sami Tolvanen wrote: > On Mon, Nov 4, 2019 at 9:11 AM Mark Rutland wrote: > > Can you please elaborate on _how_ this is incompatible in the commit > > message? > > > > For example, it's not clear to me if you mean that's functionally > > incompatible, or if you're trying to remove return-altering gadgets. > > > > If there's a functional incompatibility, please spell that out a bit > > more clearly. Likewise if this is about minimizing the set of places > > that can mess with control-flow outside of usual function conventions. > > Sure, I'll add a better description in v5. In this case, the return > address is modified in the kernel stack, which means the changes are > ignored with SCS. Ok, that makes sense to me. I'd suggest something like: | The graph tracer hooks returns by modifying frame records on the | (regular) stack, but with SCS the return address is taken from the | shadow stack, and the value in the frame record has no effect. As we | don't currently have a mechanism to determine the corresponding slot | on the shadow stack (and to pass this through the ftrace | infrastructure), for now let's disable the graph tracer when SCS is | enabled. ... as I suspect with some rework of the trampoline and common ftrace code we'd be able to correctly manipulate the shadow stack for this. Similarly, if clang gained -fpatchable-funciton-etnry, we'd get that for free. Thanks, Mark.