From patchwork Fri Mar 6 06:40:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Yan X-Patchwork-Id: 11423229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACA3014B7 for ; Fri, 6 Mar 2020 06:43:09 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 1D7C82072D for ; Fri, 6 Mar 2020 06:43:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D7C82072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-18099-patchwork-kernel-hardening=patchwork.kernel.org@lists.openwall.com Received: (qmail 24365 invoked by uid 550); 6 Mar 2020 06:42:18 -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 24119 invoked from network); 6 Mar 2020 06:42:16 -0000 From: Jason Yan To: , , , , , , , , , CC: , , , Jason Yan Subject: [PATCH v4 4/6] powerpc/fsl_booke/64: do not clear the BSS for the second pass Date: Fri, 6 Mar 2020 14:40:31 +0800 Message-ID: <20200306064033.3398-5-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200306064033.3398-1-yanaijie@huawei.com> References: <20200306064033.3398-1-yanaijie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected The BSS section has already cleared out in the first pass. No need to clear it again. This can save some time when booting with KASLR enabled. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael Ellerman Cc: Christophe Leroy Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Nicholas Piggin Cc: Kees Cook --- arch/powerpc/kernel/head_64.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 454129a3c259..9354c292b709 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S @@ -913,6 +913,13 @@ start_here_multiplatform: bl relative_toc tovirt(r2,r2) + /* Do not clear the BSS for the second pass if randomized */ + LOAD_REG_ADDR(r3, kernstart_virt_addr) + ld r3,0(r3) + LOAD_REG_IMMEDIATE(r4, KERNELBASE) + cmpd r3,r4 + bne 4f + /* Clear out the BSS. It may have been done in prom_init, * already but that's irrelevant since prom_init will soon * be detached from the kernel completely. Besides, we need