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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 53092CA9EA0 for ; Tue, 22 Oct 2019 16:00:54 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id A339E214E0 for ; Tue, 22 Oct 2019 16:00:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A339E214E0 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-17087-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 16073 invoked by uid 550); 22 Oct 2019 16:00:47 -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 16052 invoked from network); 22 Oct 2019 16:00:46 -0000 Date: Tue, 22 Oct 2019 17:00:10 +0100 From: Mark Rutland To: Nick Desaulniers Cc: Sami Tolvanen , Will Deacon , Catalin Marinas , Steven Rostedt , Ard Biesheuvel , Dave Martin , Kees Cook , Laura Abbott , clang-built-linux , Kernel Hardening , Linux ARM , LKML Subject: Re: [PATCH 12/18] arm64: reserve x18 only with Shadow Call Stack Message-ID: <20191022160010.GB699@lakrids.cambridge.arm.com> References: <20191018161033.261971-1-samitolvanen@google.com> <20191018161033.261971-13-samitolvanen@google.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 Fri, Oct 18, 2019 at 02:23:10PM -0700, Nick Desaulniers wrote: > On Fri, Oct 18, 2019 at 9:11 AM 'Sami Tolvanen' via Clang Built Linux > wrote: > > > > Only reserve x18 with CONFIG_SHADOW_CALL_STACK. Note that all external > > kernel modules must also have x18 reserved if the kernel uses SCS. > > Ah, ok. The tradeoff for maintainers to consider, either: > 1. one less GPR for ALL kernel code or > 2. remember not to use x18 in inline as lest you potentially break SCS This option only affects compiler-generated code, so I don't think that matters. I think it's fine to say that we should always avoid the use of x18 in hand-written assembly (with manual register allocation), while also allowing the compiler to use x18 if we're not using SCS. This can be folded into the earlier patch which always reserved x18. > This patch is 2 (the earlier patch was 1). Maybe we don't write > enough inline asm that this will be hard to remember, and we do have > CI in Android to watch for this (on mainline, not sure about -next). I think that we can trust the set of people who regularly review arm64 assembly to remember this. We could also document this somewhere -- we might need to document other constraints or conventions for assembly in preparation for livepatching and so on. If we wanted to, we could periodically grep for x18 to find any illicit usage. Thanks, Mark.