Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp187920imm; Fri, 5 Oct 2018 02:01:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV60SI4m7BI2TgNr59jqeQnx+nyp1M2FOaD5PJC0NktWPj3LbdUmG/0rYEeJzVT3HSqIeeCOo X-Received: by 2002:a63:d84a:: with SMTP id k10-v6mr9403314pgj.314.1538730099682; Fri, 05 Oct 2018 02:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538730099; cv=none; d=google.com; s=arc-20160816; b=0eNoKFm871YikzbIPDE71qTYpqV50ZAl4oOljDKu18wG0tiUy/Sd+vFoa2KmI/dxlm KZFZV40YPHc7wA9avhcjXJBNU/rBNEpplLC53JI7wBvg/amQ/FhRUDgLSpWMfEqWipXs WfecIk5tRw6JNo8LawPvf9sF5deiaryogUm1hMcOjEjRQrmc4gWvEt2ZJhD+BZ7iWFB4 XaVOJPLn2ZLWpB5GqeH7f650KiyHDgOYzZvcCyM6fOabJ6tyn4jMHz3N3EUCfK1+oZi1 nLNri+mfw+6Yb7ZzAacmreynIv6m2EIviQthr9fBTojIw5aLi4vGiG0KQisWFDU80+ux W2Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=re1yZhbxqR8Fk1aUeVPl/g6s/hP/QScgkc9HZovSAyk=; b=NNXPZnVX5m9c0CakE2ph1JVZzR68E0XaMwDZQvwx4RRzcFX2bADOhOmqWasZdbBhTU f2KnV+Bf8/7xz1Fs0PHVlcYTRn0B8EqU7olJGJrobxJpmPnvrvIPT15exPxzKIKNsPFC +Md4jYtcuUlvVllZIRmh7LF/kfnJk0HY3MG9NFW2WJd5ENVyWRFF5k0eXUCDKSn1Fab6 tTEAWYeajWRsuzJoeHuNnRljgIR4oE/Vv9+Aed1N9/vh0UkU6KunJHdN6xVdM1aTDF8w cPjFBuwEqNZ44pcjQLLKqm6akZsQGziQiWhVXBkRXbwGYJzAihT+vLe5cBH2GmdB/tzM Abjw== 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 d11-v6si8792160pla.245.2018.10.05.02.01.23; Fri, 05 Oct 2018 02:01:39 -0700 (PDT) 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 S1728701AbeJEP65 (ORCPT + 99 others); Fri, 5 Oct 2018 11:58:57 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48444 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727823AbeJEP65 (ORCPT ); Fri, 5 Oct 2018 11:58:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A359B80D; Fri, 5 Oct 2018 02:01:09 -0700 (PDT) Received: from [10.2.206.71] (e113077-lin.cambridge.arm.com [10.2.206.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82A1F3F5B3; Fri, 5 Oct 2018 02:01:06 -0700 (PDT) Subject: Re: [RFC 17/17] arm64: compile the kernel with ptrauth -msign-return-address To: Kristina Martsenko , "linux-arm-kernel@lists.infradead.org" Cc: Adam Wallis , Amit Kachhap , Andrew Jones , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Christoffer Dall , Dave P Martin , Jacob Bramley , Kees Cook , Marc Zyngier , Mark Rutland , Suzuki Poulose , Will Deacon , "kvmarm@lists.cs.columbia.edu" , "linux-arch@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20181005084754.20950-1-kristina.martsenko@arm.com> <20181005084754.20950-18-kristina.martsenko@arm.com> From: Ramana Radhakrishnan Message-ID: Date: Fri, 5 Oct 2018 10:01:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181005084754.20950-18-kristina.martsenko@arm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/10/2018 09:47, Kristina Martsenko wrote: > Compile all functions with two ptrauth instructions: paciasp in the > prologue to sign the return address, and autiasp in the epilogue to > authenticate the return address. This should help protect the kernel > against attacks using return-oriented programming. > > CONFIG_ARM64_PTR_AUTH enables pointer auth for both userspace and the > kernel. > > Signed-off-by: Mark Rutland > Signed-off-by: Kristina Martsenko > --- > arch/arm64/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 106039d25e2f..dbcd43ea99d8 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -56,6 +56,10 @@ KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) > KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) > KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) > > +ifeq ($(CONFIG_ARM64_PTR_AUTH),y) > +KBUILD_CFLAGS += -msign-return-address=all Glad to see this being done and being proposed for mainline. I can see why you would prefer this though have you guys experimented at all with -msign-return-address=non-leaf as well ? Orthogonally and just fair warning - the command lines for this are also being revised to provide ROP and JOP protection using BTI from v8.5-a during the GCC-9 timeframe but I suspect that's a different option. regards Ramana Reviewed-by: Ramana Radhakrishnan