Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp180834imm; Fri, 5 Oct 2018 01:51:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV63RhXjF48Ft5J8HADUPN35ZYodqFdKIZ8E1UJvDxXBwcy3M9UEeFxGyb7TiUUmx5CNXN2I1 X-Received: by 2002:a65:6204:: with SMTP id d4-v6mr9164267pgv.121.1538729517195; Fri, 05 Oct 2018 01:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538729517; cv=none; d=google.com; s=arc-20160816; b=EM/u0Tvi3craJOXO7t2AlXoua269tHjWOc3F2lSJdxMsQgz1buX2YlAd27f+nMn0uG jJUy667kf8/ihFNfAwgNxwPHFp1yUaOx5AIaPueKzSkhRqvVUmskrvE47eUkDaOM3R19 GKjVQbKnM/xHGrypwZLI9UkCzFvJmnNV4HFdrMSFojYaYhcKiHHh9jbMCSfN9eFSCiZP Hov1Ncym4Yjmg6C5UG8QZ12mOFbBv9J3xDYqLfa1i3aKE9Ipf2DFOofmgSqUT7G9FQ5d OWGGnLmCA3sEoRR0/3bQQK1xj7WNdAo6qQZ4QDVuJiWMx53vm0jZTb3whP+pKXV9s36Q WkNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=UnNiQOodXRr3Pgd/SPKtwkWFa6koidjSXw7piIu7amA=; b=bg79Bas64gi8+Msf8bTcH+1qoYMjhJtpkStVGWDto5oalzGr4d91NDVrakC9isCjGX tlSxgfEW+xlubSBO3f0JhE06DQFkBBpsJqkz29oN110O/HXJU+GQL/aG2o0sVzf4AXcJ LfR74VdiGfEfMgI8sYTgBNvA7ZUw18cuQ8lH3Cv4UggKAgm/4tboQuxjp2dsN5KwssGg GXmN84EEvNFOETnhiiKu9+feGEQ6fDSkp/ZXimyBrPB4SiFdBMxN8+ZXGy4Y2XCOTIwp CHymyHezuoJaxmYG0zhCW7bDoVCvB02dLcB/qQIpGXWlInfQWN5nZTLKqexMOzmnc7j/ M6bw== 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 p3-v6si7926389pld.329.2018.10.05.01.51.41; Fri, 05 Oct 2018 01:51:57 -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 S1729001AbeJEPss (ORCPT + 99 others); Fri, 5 Oct 2018 11:48:48 -0400 Received: from foss.arm.com ([217.140.101.70]:48126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728608AbeJEPss (ORCPT ); Fri, 5 Oct 2018 11:48:48 -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 C49E616A3; Fri, 5 Oct 2018 01:51:03 -0700 (PDT) Received: from moonbear.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F75B3F5B3; Fri, 5 Oct 2018 01:51:00 -0700 (PDT) From: Kristina Martsenko To: 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 , Ramana Radhakrishnan , "Suzuki K . Poulose" , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 17/17] arm64: compile the kernel with ptrauth -msign-return-address Date: Fri, 5 Oct 2018 09:47:54 +0100 Message-Id: <20181005084754.20950-18-kristina.martsenko@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181005084754.20950-1-kristina.martsenko@arm.com> References: <20181005084754.20950-1-kristina.martsenko@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 +endif + ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) KBUILD_CPPFLAGS += -mbig-endian CHECKFLAGS += -D__AARCH64EB__ -- 2.11.0