Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp175377ybv; Tue, 4 Feb 2020 18:57:51 -0800 (PST) X-Google-Smtp-Source: APXvYqz1cjCzpDtOg3vMTpeejhDujxSjPrl3203whPfyHHA5Jha7YZFyA3xAerxafjWp9BuURSTM X-Received: by 2002:a9d:48d:: with SMTP id 13mr23370077otm.249.1580871471170; Tue, 04 Feb 2020 18:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580871471; cv=none; d=google.com; s=arc-20160816; b=A8RjjF0q53wKQc7MNzYujF6iN4S2srZSCkxBd9WkHAkdBwZ0xvonLMP/r6m1Fmddbq eb/bf2k6Jf2N5X26jSkfKIQw7dSC9bHCbHWaFIgOysnxYDAySgH+j9ezRbXLHNsWH6gA Kebr1mWtOx1Ok7sMKY8XKGFJ7SFPRX/3p9pCRK+RJlgiy5DcO9dZvrJ1l2xhY/CsS7ZF I3yoFjsFb5PN2tKntSP0xd2EuyynvjKGPuJEzxtY00rtxX2ZKR2hqSAVMXEPPcOEqImF ezpz543xy0GgJerkzAn3gwLBMh+nnPvNNwEYxNUaSOdE21l4OkbgP0aX4Yq5ELhpmknq MQCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=v49XuJYYAsh9kxVQ0YT6Jxwm+4M/L0VBKePEqt88R7s=; b=THh5njUmT4aBAMunc05mTJsA+cJEz2m4T8Qb4YaqWc5xN4swbzUbxx15iHJc1CDBlQ QPlxjJzXU+Gyn0WFcSJCpb/mOASbZUB4HUf4oxrP8jpTI6B8mlkECbcSgijoqicPblok 7Lxmydyrp4n9z1tto7/XV+mCc7hnG+P4doA/3VLUVmgfY+AG/41QH1OT7PFa+8zVrIz9 883/ATPf0nofKCodqHHoIkuLg58CyS0KAmfPWH4ul2ej9yjduLMVVqCvdJyhSMmyyQo7 8F/54FJSEk0gQy0yKvemZQrcF3T5KPzP01+RZeaNqnORagzrcVsdWx9InnhYevEQdveD N4tQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si12819640otk.173.2020.02.04.18.57.39; Tue, 04 Feb 2020 18:57:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbgBEC4o (ORCPT + 99 others); Tue, 4 Feb 2020 21:56:44 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:42054 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727855AbgBEC4n (ORCPT ); Tue, 4 Feb 2020 21:56:43 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9D844A9A9D028905D014; Wed, 5 Feb 2020 10:56:41 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Wed, 5 Feb 2020 10:56:31 +0800 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 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.2