From patchwork Sun Sep 3 12:07:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9936137 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 C572E6037D for ; Sun, 3 Sep 2017 12:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7408286B0 for ; Sun, 3 Sep 2017 12:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABD95286A9; Sun, 3 Sep 2017 12:10:52 +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 9EF5D286A9 for ; Sun, 3 Sep 2017 12:10:51 +0000 (UTC) Received: (qmail 13876 invoked by uid 550); 3 Sep 2017 12:09: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 13766 invoked from network); 3 Sep 2017 12:09:09 -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=8t6IV4bmNjAgcv5Be09tvxPF5UJpUqInMAYOh79BmGQ=; b=Z2mp3XCcguOdNV4LpiHTNNbCXshlXuKMaL6yWyzTnXgCEX/TsPXbpbJpIr1M68mqzW Pzik3xT7hIi+R2kGSdwiSWLBRAV7dhGcAtYiwYcuDDmh4AY19D5V4foN8xzbT7j5Ug8m OYeU+4c4E/FqsC1A34jTFHtWBloK5x8e5XEIU= 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=8t6IV4bmNjAgcv5Be09tvxPF5UJpUqInMAYOh79BmGQ=; b=SxTcHQhBpI/fPgXQ2jh7MDi3F1lT+GvsLFJeJWLG+NiPADXNiw5x6eMgCOyDkhrU3w jQvhiFjlx3gHABZ3P5DbA2dlKhRzDZi65RHgG7iPKQ5pjHYr5p0wBaHHhc+GrKakqVJk cZtNV4C5pjFAwU+QBQ4PQ6NujdXJ4iOZdOhjaDrK8UBTbGt4cObPj0PQCQ8Uw+aV5fqJ iq4UAv9ZByZOZaXAx/7W6YLO7wb7cWNuPGpL4AFHEBy2QAmuWmpzLXq0Aidtrl5JiKJa Tzq0oPbLb2TejRoHqH7lnleIt3JwNigt/XA15Al+FMlKmOt+8I1arsm/kYylpHIS3mRi nNtg== X-Gm-Message-State: AHPjjUgNDrtnHjta8ZnQmio4T2P+sMVpE2yjK6MFm+1TTxTpnMdZkLDP PLAwXSXGOD35VdYG8BC1yg== X-Google-Smtp-Source: ADKCNb4S7ntsiwhiIX6zu1rnfimvKWRInivWq/0woAnAPXk7EhGsaP9ugTNGEuu3lKIwZit9bjC+Uw== X-Received: by 10.223.176.80 with SMTP id g16mr257377wra.113.1504440538309; Sun, 03 Sep 2017 05:08:58 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Cc: Ard Biesheuvel , Arnd Bergmann , Nicolas Pitre , Russell King , Kees Cook , Thomas Garnier , Marc Zyngier , Mark Rutland , Tony Lindgren , Matt Fleming , Dave Martin Date: Sun, 3 Sep 2017 13:07:41 +0100 Message-Id: <20170903120757.14968-14-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170903120757.14968-1-ard.biesheuvel@linaro.org> References: <20170903120757.14968-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v2 13/29] arm-soc: exynos: replace open coded VA->PA conversions X-Virus-Scanned: ClamAV using ClamSMTP This replaces a couple of open coded calculations to obtain the physical address of a far symbol with calls to the new adr_l etc macros. Signed-off-by: Ard Biesheuvel Acked-by: Nicolas Pitre --- arch/arm/mach-exynos/headsmp.S | 9 +------ arch/arm/mach-exynos/sleep.S | 26 ++++---------------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S index d3d24ab351ae..25de5aff1c41 100644 --- a/arch/arm/mach-exynos/headsmp.S +++ b/arch/arm/mach-exynos/headsmp.S @@ -23,10 +23,7 @@ ENTRY(exynos4_secondary_startup) ARM_BE8(setend be) mrc p15, 0, r0, c0, c0, 5 and r0, r0, #15 - adr r4, 1f - ldmia r4, {r5, r6} - sub r4, r4, r5 - add r6, r6, r4 + adr_l r6, pen_release pen: ldr r7, [r6] cmp r7, r0 bne pen @@ -37,7 +34,3 @@ pen: ldr r7, [r6] */ b secondary_startup ENDPROC(exynos4_secondary_startup) - - .align 2 -1: .long . - .long pen_release diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S index cf950790fbdc..003465699263 100644 --- a/arch/arm/mach-exynos/sleep.S +++ b/arch/arm/mach-exynos/sleep.S @@ -17,6 +17,7 @@ #include #include +#include #include #include "smc.h" @@ -62,19 +63,13 @@ ENTRY(exynos_cpu_resume_ns) cmp r0, r1 bne skip_cp15 - adr r0, _cp15_save_power - ldr r1, [r0] - ldr r1, [r0, r1] - adr r0, _cp15_save_diag - ldr r2, [r0] - ldr r2, [r0, r2] + ldr_l r1, cp15_save_power + ldr_l r2, cp15_save_diag mov r0, #SMC_CMD_C15RESUME dsb smc #0 #ifdef CONFIG_CACHE_L2X0 - adr r0, 1f - ldr r2, [r0] - add r0, r2, r0 + adr_l r0, l2x0_saved_regs /* Check that the address has been initialised. */ ldr r1, [r0, #L2X0_R_PHY_BASE] @@ -93,9 +88,7 @@ ENTRY(exynos_cpu_resume_ns) smc #0 /* Reload saved regs pointer because smc corrupts registers. */ - adr r0, 1f - ldr r2, [r0] - add r0, r2, r0 + adr_l r0, l2x0_saved_regs ldr r1, [r0, #L2X0_R_PWR_CTRL] ldr r2, [r0, #L2X0_R_AUX_CTRL] @@ -114,15 +107,6 @@ skip_cp15: b cpu_resume ENDPROC(exynos_cpu_resume_ns) - .align -_cp15_save_power: - .long cp15_save_power - . -_cp15_save_diag: - .long cp15_save_diag - . -#ifdef CONFIG_CACHE_L2X0 -1: .long l2x0_saved_regs - . -#endif /* CONFIG_CACHE_L2X0 */ - .data .globl cp15_save_diag cp15_save_diag: