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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 CB1B1CA9EC9 for ; Fri, 1 Nov 2019 04:00:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FA342083E for ; Fri, 1 Nov 2019 04:00:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SoIAx/f+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725904AbfKAEAC (ORCPT ); Fri, 1 Nov 2019 00:00:02 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39286 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725208AbfKAEAC (ORCPT ); Fri, 1 Nov 2019 00:00:02 -0400 Received: by mail-pf1-f194.google.com with SMTP id x28so2873875pfo.6 for ; Thu, 31 Oct 2019 21:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=A7vrO+MQB63nPz6FPwTRdUgznbxQobdODcdehGRotvI=; b=SoIAx/f+o5ObJpWgtzqlvIdoi9BrVBtR0sORn7UXLhxKD40+Hq5g8o71ljOsCw58Xu nV5Xy/0YwVtNd7g4N0HQfZNFqvK0+sr9AAyTxnNs4Qwhx3+vEE4Ynyv8Aid4jjjCxSzD BwrcVTfNY0xZuV8VaybEOQY3+plZAuUInWL9I= 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=A7vrO+MQB63nPz6FPwTRdUgznbxQobdODcdehGRotvI=; b=YVzkCu8q4hHtAXr5TLOnw1srSrksswGpZ9iSw/ZPSDYUFePbb4LpgpLQqivvQzDGM9 ruGs/o83OaicLy0uBofoAVoV4E1886rBFsUaVpM0JdHABnVkWbfFoM5LCeGS1JN18DXu d9qiP7Us9I5VUhP+wicbfN5hg0NABrEBgAtNkaCv0g+PRmMet6O3B9w8YvWaHB3pUVQn 2Xa3TXgOuwX0a9iiLLaGzQ9LFGPjZBUdTNuPxRpW68PNTigBeorGkxFjSbfx/qJGa4CW 5NNsourNtPucedqtCp72ab1D85v+Aok00FgT0vvF2lfzFVxA2OVzjyMln53YA6Uo+l/D TdTg== X-Gm-Message-State: APjAAAW8vBrL5cxbk0t3JUa5AHcX65SlYa+VQpcFyOmTgvN5YcYJ1CkK 2wb1Tew4IoZBV1ES4862gtvJpw== X-Google-Smtp-Source: APXvYqxYKGSK6I8b7hoUIAqJTB3Ku0XRihpPu4nBcAxKCNBJscoqFmYbPUJv9aMkupfl7+/RJ59IiA== X-Received: by 2002:a63:611:: with SMTP id 17mr10933319pgg.191.1572580800014; Thu, 31 Oct 2019 21:00:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id v19sm833472pgn.84.2019.10.31.20.59.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 20:59:59 -0700 (PDT) Date: Thu, 31 Oct 2019 20:59:58 -0700 From: Kees Cook To: samitolvanen@google.com Cc: Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Dave Martin , Laura Abbott , Mark Rutland , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 12/17] arm64: reserve x18 from general allocation with SCS Message-ID: <201910312059.C43A11D@keescook> References: <20191018161033.261971-1-samitolvanen@google.com> <20191031164637.48901-1-samitolvanen@google.com> <20191031164637.48901-13-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191031164637.48901-13-samitolvanen@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 31, 2019 at 09:46:32AM -0700, samitolvanen@google.com wrote: > Reserve the x18 register from general allocation when SCS is enabled, > because the compiler uses the register to store the current task's > shadow stack pointer. Note that all external kernel modules must also be > compiled with -ffixed-x18 if the kernel has SCS enabled. > > Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook -Kees > --- > arch/arm64/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 2c0238ce0551..ef76101201b2 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -72,6 +72,10 @@ stack_protector_prepare: prepare0 > include/generated/asm-offsets.h)) > endif > > +ifeq ($(CONFIG_SHADOW_CALL_STACK), y) > +KBUILD_CFLAGS += -ffixed-x18 > +endif > + > ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) > KBUILD_CPPFLAGS += -mbig-endian > CHECKFLAGS += -D__AARCH64EB__ > -- > 2.24.0.rc0.303.g954a862665-goog > -- Kees Cook 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 67CF7CA9ECF for ; Fri, 1 Nov 2019 04:00: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 3D6A9208CB for ; Fri, 1 Nov 2019 04:00: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="hr3pCi6O"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SoIAx/f+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D6A9208CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.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=EXbdAgH3R4SqCYwqOIbt/752ymZ+a5K+WtDFjst7aRo=; b=hr3pCi6OKXneNA UdiA/q//e3Nm/Le9gA8fTUjj0qS3go1L0u/s2FAVY7rOE2WnHwfdwiEX3DQTCy+hjdtevYRSs3aPp JHv6pJ4xgBd5AHscAY5ZI1r5NC5kbYgBjopsc4pnwQS7rz+wydUjyEJxHuccg4/RWhhPdB8TVC7w7 jhZYI7sx2ify6/Bd9LvUl82WXFQ7Wvawwf/b1lbgyN/WoFfAwPb1XapbTQuLeqoT26UOSfhPi8zEw CQtOqFUJibdn63H5/GTfQ2/dezVJt0jOpei/v4a/FJOwmSaj2XetmADXOZRWU25cftoOjR4kGkyKr ZI1IV/Wt5LDrRrkXtN0Q==; 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 1iQO6V-0002kj-JO; Fri, 01 Nov 2019 04:00:03 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQO6S-0002dl-MV for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 04:00:01 +0000 Received: by mail-pf1-x444.google.com with SMTP id c184so6112458pfb.0 for ; Thu, 31 Oct 2019 21:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=A7vrO+MQB63nPz6FPwTRdUgznbxQobdODcdehGRotvI=; b=SoIAx/f+o5ObJpWgtzqlvIdoi9BrVBtR0sORn7UXLhxKD40+Hq5g8o71ljOsCw58Xu nV5Xy/0YwVtNd7g4N0HQfZNFqvK0+sr9AAyTxnNs4Qwhx3+vEE4Ynyv8Aid4jjjCxSzD BwrcVTfNY0xZuV8VaybEOQY3+plZAuUInWL9I= 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=A7vrO+MQB63nPz6FPwTRdUgznbxQobdODcdehGRotvI=; b=Nw554XurS1fic3Mz5zGsKgIRyViHmCy+bjw+91k26UhM+U7ER0tRXqOHZeBLUwp/CV hd/JVlpn5vlOglVhNTSKOrHx6wWkqx3D+zbs4KBsvzXqwlj/cKNaflWIitd9FIWTjswJ d6RNRmx8Gr65W4wUcpuSEflYADrOAFlojmxB3lWX9xnYNjERtLi4PxXNf00O/vHsds/t kN8bqe1cEMA2G3FjJAFws7lmXryfHtg5b1so212wJbTdv4ehQpjNdED4duvSyAZF7d/d 6HMe//Tt0UR2BMeWZxWmraEM7BZ+YUOdP+Yt702ekU+8b2NFksCTTUbgHToSes+VX+nk YKEA== X-Gm-Message-State: APjAAAWtXE9CQYuo9WfVGj4B1NUx1g5KzPX4Fa48YRw+7oX13wzz9Yul UrnHK4RKZ1nK2xWvCiOSEwVmBQ== X-Google-Smtp-Source: APXvYqxYKGSK6I8b7hoUIAqJTB3Ku0XRihpPu4nBcAxKCNBJscoqFmYbPUJv9aMkupfl7+/RJ59IiA== X-Received: by 2002:a63:611:: with SMTP id 17mr10933319pgg.191.1572580800014; Thu, 31 Oct 2019 21:00:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id v19sm833472pgn.84.2019.10.31.20.59.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 20:59:59 -0700 (PDT) Date: Thu, 31 Oct 2019 20:59:58 -0700 From: Kees Cook To: samitolvanen@google.com Subject: Re: [PATCH v3 12/17] arm64: reserve x18 from general allocation with SCS Message-ID: <201910312059.C43A11D@keescook> References: <20191018161033.261971-1-samitolvanen@google.com> <20191031164637.48901-1-samitolvanen@google.com> <20191031164637.48901-13-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191031164637.48901-13-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191031_210000_733308_E15A4B17 X-CRM114-Status: GOOD ( 14.29 ) 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: Mark Rutland , clang-built-linux@googlegroups.com, Ard Biesheuvel , Masahiro Yamada , Catalin Marinas , Jann Horn , Nick Desaulniers , linux-kernel@vger.kernel.org, Steven Rostedt , Miguel Ojeda , Masami Hiramatsu , kernel-hardening@lists.openwall.com, Laura Abbott , Will Deacon , Dave Martin , linux-arm-kernel@lists.infradead.org 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 Thu, Oct 31, 2019 at 09:46:32AM -0700, samitolvanen@google.com wrote: > Reserve the x18 register from general allocation when SCS is enabled, > because the compiler uses the register to store the current task's > shadow stack pointer. Note that all external kernel modules must also be > compiled with -ffixed-x18 if the kernel has SCS enabled. > > Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook -Kees > --- > arch/arm64/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 2c0238ce0551..ef76101201b2 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -72,6 +72,10 @@ stack_protector_prepare: prepare0 > include/generated/asm-offsets.h)) > endif > > +ifeq ($(CONFIG_SHADOW_CALL_STACK), y) > +KBUILD_CFLAGS += -ffixed-x18 > +endif > + > ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) > KBUILD_CPPFLAGS += -mbig-endian > CHECKFLAGS += -D__AARCH64EB__ > -- > 2.24.0.rc0.303.g954a862665-goog > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel