From patchwork Wed Jul 12 14:44:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9836881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF30F60363 for ; Wed, 12 Jul 2017 14:46:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1AD4204C1 for ; Wed, 12 Jul 2017 14:46:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B658C284E4; Wed, 12 Jul 2017 14:46:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id EB41B284FF for ; Wed, 12 Jul 2017 14:45:59 +0000 (UTC) Received: (qmail 1662 invoked by uid 550); 12 Jul 2017 14:45:20 -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: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 1520 invoked from network); 12 Jul 2017 14:45:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v+7sxqdO2AghdWZkZRNS9smN3ctbVONlwcPtmmBG4xg=; b=cnI1Bw26ByLb5OR9KrVRYxUZK8ihDnK8U4cRhsft8U48ohXFI7JBc1DJPB/ikQw+FI ZBW7TKt/E9h6gSSMjt0ERKPYHkEo9UaNOeE7FNrPGKL/D1jIA26yHSZvYp/PQ/COs4Fv hSa6/YyfAbLAGelH8Li5KOOfiWKjwNY2b+LM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v+7sxqdO2AghdWZkZRNS9smN3ctbVONlwcPtmmBG4xg=; b=TcsHZcsVhSxndsTjrrszOBqRQ/jLj34z9Pwe6C2F+8JOjoYHvLgd4mNGAbmXHH6WOj xmu3qNiH198Dj6wcdfRnp5fhEFwBIOdF5N0gHe1mlmFdJTUgDd8iFcweA4v2kFnROht5 lQA7FxyMZTE5xDiO3gakcFYRQTSeFI8XqcCPUqu82Xeh+k4CF+2mDl2xwv6i5oOBkvnB IKkCLMjE3PIw1KJWqQE6kw5uQGi7aEqBFV3IFMVkqft0GzXtc/pzEwGvQeYixaT1Ajcx Vi6F78noO7mv/liA1yXPlXGo+bSPIll5COVJLGI3ZL8koEYRmBby7ctlpISiR43qcV3F o67A== X-Gm-Message-State: AIVw1139cAS+hhKYk4TbJy33UzKfMYMbJN4trRORBtGosU+2ZsS6M9WF bZ5dhDPQIJ7zMDf2 X-Received: by 10.28.140.84 with SMTP id o81mr2992048wmd.76.1499870705669; Wed, 12 Jul 2017 07:45:05 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Cc: mark.rutland@arm.com, labbott@fedoraproject.org, will.deacon@arm.com, dave.martin@arm.com, catalin.marinas@arm.com, Ard Biesheuvel Date: Wed, 12 Jul 2017 15:44:19 +0100 Message-Id: <20170712144424.19528-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170712144424.19528-1-ard.biesheuvel@linaro.org> References: <20170712144424.19528-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [RFC PATCH 06/10] arm64: kbuild: reserve reg x18 from general allocation by the compiler X-Virus-Scanned: ClamAV using ClamSMTP Before we can start using register x18 for a special purpose (as permitted by the AAPCS64 ABI), we need to tell the compiler that it is off limits for general allocation. So tag it as 'fixed', and remove the mention from the LL/SC compiler flag override. Signed-off-by: Ard Biesheuvel --- arch/arm64/Makefile | 2 +- arch/arm64/lib/Makefile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 9b41f1e3b1a0..68164338185a 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -46,7 +46,7 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable) endif KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables +KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -ffixed-x18 KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads) KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile index c86b7909ef31..b52f34fd5ba5 100644 --- a/arch/arm64/lib/Makefile +++ b/arch/arm64/lib/Makefile @@ -15,5 +15,4 @@ CFLAGS_atomic_ll_sc.o := -fcall-used-x0 -ffixed-x1 -ffixed-x2 \ -ffixed-x3 -ffixed-x4 -ffixed-x5 -ffixed-x6 \ -ffixed-x7 -fcall-saved-x8 -fcall-saved-x9 \ -fcall-saved-x10 -fcall-saved-x11 -fcall-saved-x12 \ - -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15 \ - -fcall-saved-x18 + -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15