From patchwork Mon Aug 14 12:53:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9898799 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 A90B8602BA for ; Mon, 14 Aug 2017 12:55:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E3AF285E3 for ; Mon, 14 Aug 2017 12:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92C1028602; Mon, 14 Aug 2017 12:55:43 +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 A7500285E3 for ; Mon, 14 Aug 2017 12:55:42 +0000 (UTC) Received: (qmail 21988 invoked by uid 550); 14 Aug 2017 12:55:08 -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 20016 invoked from network); 14 Aug 2017 12:54:59 -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=I4KvIYoWTSveWCacNqB0teFM6R7k4ks5QZGb78nKJRw=; b=A+5NO3JxyNSOvJmdO5k1mPsZhwqB4izPTCHUkcAs72X++sZe1p/qFNHc3tD4x4bK8B bCBGiypJvjQ5eUJTfjZ0j1RDgjsZDYsSI+Z1yONsluuQfZR+s/F/jilHl0tcrgJemsC+ a2Eg5E4/wgFAQb0mrWCa/QYOU57FHaHhbYo88= 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=I4KvIYoWTSveWCacNqB0teFM6R7k4ks5QZGb78nKJRw=; b=ioT6OkksAbva4wruE7jVMVWQq7W8iwfJ7Q6lYhrczpoOb6f+FRV0WOF9HCLlO7oslY l0RCEalUvX8YIHCOms6G3UyYEAINC4SvQhfXrkwlzir55sqSG7WjKeoFMcRAIeRR7rYH i1tiCnFP4vJ2WNWGaACzzV+pFjTwUT+SN9yqaN64GaQ7YJZ6bT6ZEvSkFIByPBxWn69Q a0RqfB87cL9E4kLEK9Zz0b4jKXo7nI635FiZFzxdCgZQ2cSKnjbuOPKMiEfdCPDo2B8D c3LVur0/yBH+FtIg4teJ9pdtx64an8M5jf96bf27VusLyicTIZqUPmVYRwtm7++YMxBQ HS2g== X-Gm-Message-State: AHYfb5h3f3DK36pcviykjP+NPcLWoRmWFvs59b/TF/lnePnDUcxIXRsm 61TpYVDf/XkicNW36qmCgQ== X-Received: by 10.28.210.139 with SMTP id j133mr4178870wmg.104.1502715288176; Mon, 14 Aug 2017 05:54:48 -0700 (PDT) From: Ard Biesheuvel To: kernel-hardening@lists.openwall.com Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Arnd Bergmann , Nicolas Pitre , Russell King , Kees Cook , Thomas Garnier , Marc Zyngier , Mark Rutland , Tony Lindgren , Matt Fleming , Dave Martin Date: Mon, 14 Aug 2017 13:53:48 +0100 Message-Id: <20170814125411.22604-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814125411.22604-1-ard.biesheuvel@linaro.org> References: <20170814125411.22604-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH 07/30] ARM: head: use PC-relative insn sequence for __smp_alt X-Virus-Scanned: ClamAV using ClamSMTP Replace the open coded PC relative offset calculations with a pair of adr_l invocations. This ensures these quantities are invariant under runtime relocation. Cc: Russell King Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/head.S | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index ec22f42fd8bb..db6b823f20a4 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -523,19 +523,11 @@ ARM_BE8(rev r0, r0) @ byteswap if big endian retne lr __fixup_smp_on_up: - adr r0, 1f - ldmia r0, {r3 - r5} - sub r3, r0, r3 - add r4, r4, r3 - add r5, r5, r3 + adr_l r4, __smpalt_begin + adr_l r5, __smpalt_end b __do_fixup_smp_on_up ENDPROC(__fixup_smp) - .align -1: .word . - .word __smpalt_begin - .word __smpalt_end - .pushsection .data .globl smp_on_up smp_on_up: