From patchwork Sun Sep 3 12:07:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9936123 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 344846037D for ; Sun, 3 Sep 2017 12:09:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 235EC286A9 for ; Sun, 3 Sep 2017 12:09:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14E33286B4; Sun, 3 Sep 2017 12:09:55 +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 43D80286A9 for ; Sun, 3 Sep 2017 12:09:54 +0000 (UTC) Received: (qmail 11522 invoked by uid 550); 3 Sep 2017 12:08:56 -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 11331 invoked from network); 3 Sep 2017 12:08:53 -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=MeGhzl0RSimzPFPJn25f5h+R3XuyeoxHYAuPCT2cvhdGgCTbQfmDr33/D0re5X/jmw ED6UNC4js+Q6Pbbmejo45PrNJ0DP1XpoRPhMI9nTZ0poNIvOH8vuqnL+5pFouK/01tS8 7JoJauZ/43jPYnZAeSIiB8Y2rZArE8xrZi7fA= 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=NmNn2NSRLuPHrV22wAuDdh1FjdxwEmD9DbxfhBBKcTSvh409R5kfGEP47e2l/RdrFR Rnc6c2mBqO/bEDa+cmsvWfVjX4Q8VGE0e+pleeFCfJ+la19nZOgBmQcQp2iBsTrrrMTY 57vmofho7e3VCrTMvQ5ocxLMa8DYLWoc1OzD9Jx2HTgApFJNGX+d/7gnQAxjW9BfSaZp Mq6Xkse3vnkzxtVqe3Jx7ll2Xx7E76TUiX65yS/FsrnF/0BU+49zUIa/YiiCff/RJlBd A4bF8sQRQQrlAvbLZUh4UtA+N9iUJ2MgglKgP4pD/0cUloJZlLh2TSoDjHk2eUZvC/Jh KtCA== X-Gm-Message-State: AHPjjUhbSfgr9UWURviX0hAMYXXBd876kQR6enOWqxTcbeznHh2fW2CU ut9m+4JCHGgpZR/M X-Google-Smtp-Source: ADKCNb52EjvoIS+C7OAY/JL9wZeZMzDM8BIRAO5uuYTmrhdmJ8B5o9CWFjk/hZrSr6SMMUeVhYMi7A== X-Received: by 10.223.174.81 with SMTP id u17mr4848026wrd.317.1504440522667; Sun, 03 Sep 2017 05:08:42 -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:36 +0100 Message-Id: <20170903120757.14968-9-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 08/29] 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 Acked-by: Nicolas Pitre --- 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: