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=-1.1 required=3.0 tests=DATE_IN_PAST_06_12, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 D0FE3C5DF60 for ; Tue, 5 Nov 2019 19:55:22 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 1BB3F21D6C for ; Tue, 5 Nov 2019 19:55:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BB3F21D6C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-17290-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 18232 invoked by uid 550); 5 Nov 2019 19:55:09 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 18190 invoked from network); 5 Nov 2019 19:55:08 -0000 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) 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.