From patchwork Mon Aug 14 12:53:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9898811 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 5356E603B5 for ; Mon, 14 Aug 2017 12:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47E40285FD for ; Mon, 14 Aug 2017 12:57:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B93828634; Mon, 14 Aug 2017 12:57:19 +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 3DE0328606 for ; Mon, 14 Aug 2017 12:57:17 +0000 (UTC) Received: (qmail 22229 invoked by uid 550); 14 Aug 2017 12:55:11 -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 20383 invoked from network); 14 Aug 2017 12:55:03 -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=qVwwZv5cVJLFrFIZWKPDugl12/5aWWtNTrDvraSpoBo=; b=euzTBZLGRFamWmAo9ypy7cr4i1BdxKMJ7mrXHArNNZprR9g5/1JgIkSfWmd0qT48i+ vVQaOHDG2YRAZqwY002gT5bZz6M1oASeXrPXX6KdDqH8uhUefuZwlpo2o0KgDfkyQgGs maQidx9KeR8h10YUH+/9OUAmdI2myaMbhavGw= 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=qVwwZv5cVJLFrFIZWKPDugl12/5aWWtNTrDvraSpoBo=; b=WZ7aKgGr4ByZA1XmZznf4g8Y4/X4R1Mo6129S5o18QargCWurB7qAbn//e/0lfONEB z+qGz9+FTSy3RKm7qZ8EwT2FiWqA5n5bV9yHL0eoRcQ78LXVwe6kvlNOHt7R1bKPtbVE 8Zwg6T+2jfOEy9La47ncasmt07Ft6Qk23NlTkZUy/FFhmu1dNprhOVPj6SJOJ9Vl00SE mNeCiU6RSlBarP37zTW6uwBUNd9//zxfZf2uerHykUd7yZpijAeEttVSIA2JxdXjH+n1 1wHNPvoXUErgKX5qFAoJFbilnu3AwQ8lemOdIL1G7Dl634xvPfr8dbqmVscFGmlRqp3p E26Q== X-Gm-Message-State: AHYfb5h01WcEVg/kHZar7v04djKbwPjet9wv5w+OEJqU4JD0lgqS1zNG l3+xOc7WWY8XSG4nUIgPTw== X-Received: by 10.28.32.208 with SMTP id g199mr3587531wmg.180.1502715291537; Mon, 14 Aug 2017 05:54:51 -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:49 +0100 Message-Id: <20170814125411.22604-9-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 08/30] ARM: sleep.S: use PC-relative insn sequence for sleep_save_sp/mpidr_hash X-Virus-Scanned: ClamAV using ClamSMTP Replace the open coded PC relative offset calculations with adr_l and ldr_l invocations. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/sleep.S | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index 0f6c1000582c..3026b119d3ff 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -137,9 +137,8 @@ ARM_BE8(setend be) @ ensure we are in BE mode mov r1, #0 ALT_SMP(mrc p15, 0, r0, c0, c0, 5) ALT_UP_B(1f) - adr r2, mpidr_hash_ptr - ldr r3, [r2] - add r2, r2, r3 @ r2 = struct mpidr_hash phys address + adr_l r2, mpidr_hash @ r2 = struct mpidr_hash phys address + /* * This ldmia relies on the memory layout of the mpidr_hash * struct mpidr_hash. @@ -147,10 +146,7 @@ ARM_BE8(setend be) @ ensure we are in BE mode ldmia r2, { r3-r6 } @ r3 = mpidr mask (r4,r5,r6) = l[0,1,2] shifts compute_mpidr_hash r1, r4, r5, r6, r0, r3 1: - adr r0, _sleep_save_sp - ldr r2, [r0] - add r0, r0, r2 - ldr r0, [r0, #SLEEP_SAVE_SP_PHYS] + ldr_l r0, sleep_save_sp + SLEEP_SAVE_SP_PHYS ldr r0, [r0, r1, lsl #2] @ load phys pgd, stack, resume fn @@ -164,12 +160,6 @@ ENDPROC(cpu_resume) ENDPROC(cpu_resume_arm) #endif - .align 2 -_sleep_save_sp: - .long sleep_save_sp - . -mpidr_hash_ptr: - .long mpidr_hash - . @ mpidr_hash struct offset - .data .type sleep_save_sp, #object ENTRY(sleep_save_sp)