From patchwork Wed Feb 5 02:55:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Yan X-Patchwork-Id: 11365699 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 DC9AC14E3 for ; Wed, 5 Feb 2020 02:57:29 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 4F70F2082E for ; Wed, 5 Feb 2020 02:57:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F70F2082E 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-17667-patchwork-kernel-hardening=patchwork.kernel.org@lists.openwall.com Received: (qmail 5182 invoked by uid 550); 5 Feb 2020 02:56: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 4050 invoked from network); 5 Feb 2020 02:56:53 -0000 From: Jason Yan To: , , , , , , , , , CC: , , Jason Yan Subject: [PATCH v2 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized Date: Wed, 5 Feb 2020 10:55:26 +0800 Message-ID: <20200205025527.28640-6-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200205025527.28640-1-yanaijie@huawei.com> References: <20200205025527.28640-1-yanaijie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected The original kernel still exists in the memory, clear it now. 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/mm/nohash/kaslr_booke.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c index c6f5c1db1394..ed1277059368 100644 --- a/arch/powerpc/mm/nohash/kaslr_booke.c +++ b/arch/powerpc/mm/nohash/kaslr_booke.c @@ -378,8 +378,10 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size) unsigned int *__kaslr_offset = (unsigned int *)(KERNELBASE + 0x58); unsigned int *__run_at_load = (unsigned int *)(KERNELBASE + 0x5c); - if (*__run_at_load == 1) + if (*__run_at_load == 1) { + kaslr_late_init(); return; + } /* Setup flat device-tree pointer */ initial_boot_params = dt_ptr;