Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1005381ybv; Wed, 5 Feb 2020 19:02:09 -0800 (PST) X-Google-Smtp-Source: APXvYqw+pz9Irj6+hxnpnUP5dWV6k1SF8hvuER4ri8Q9dM2Kr3Jd0VqXMuwIPI73HH54NJIxTHVb X-Received: by 2002:a9d:750b:: with SMTP id r11mr27945645otk.310.1580958128882; Wed, 05 Feb 2020 19:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580958128; cv=none; d=google.com; s=arc-20160816; b=xe7P8BLzZNPVWmOBORg2E0c6Xt7pgrY96IlGJUzVIIL5L3/XCSvSZ3kNIjT2qA/EGX hFhxINEO/eL5kSdo6uhXoqxWTjFqBoUaygV6LcZ/3lz+6RSHBgaKjb9N/OVybjXcRCI6 EbEzsNCWpn3SIMtjYbOKxBuqqlhM2+8VBuY3bGVavfDQJWgwJBIqZMtPfpCQvnYEB9h8 ohAeKmjQw2jmqShsqfsv1UnaSus0eF9NRFEZiiAVhpLbuMNIukfwG8pbYmLSLZnLbeZ6 Iwn232CIg3lQlC9KpK0qKXbUyhtL1vbe4sW8O8pNm5sPKuEtuU6GRE6qcW8iUqLYVJPp 86DA== 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=cwQrnHZZisirWWaMLpdBqm5l92r5zXwY0X4Aebq2revcr9LzQl6HtmRnR5IND4SOcn 44a2x1VpXUabjB9oq5Jlixg1QEKogghgZU9IgdwUZ0K5NZPy+MlIAu1zMaF+mm3Nu2+/ mxemv6jRH98+iTmdeNCzfA44b/vrx37w1DDVdY3JGngJ0AtyHJjfOUl99ns1ODoQhRy3 mrrr1gUDvg03eZE/LqrV6zPEnHretyRf9UvzFaS7bPiQphi7hkEQgXnJFvGQ3tp05Fxq aJxEnt9YeKH/xAvUcC3DaHuFOJICEs4Bx9Ntm2qa55OLlHVSWJP1qvJh7d2vKsov+7d+ ktig== 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 l26si1139015oti.152.2020.02.05.19.01.57; Wed, 05 Feb 2020 19:02:08 -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 S1727828AbgBFC7q (ORCPT + 99 others); Wed, 5 Feb 2020 21:59:46 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10156 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727809AbgBFC7l (ORCPT ); Wed, 5 Feb 2020 21:59:41 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3473AAC64FCBA159478C; Thu, 6 Feb 2020 10:59:40 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Thu, 6 Feb 2020 10:59:29 +0800 From: Jason Yan To: , , , , , , , , , CC: , , Jason Yan Subject: [PATCH v3 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized Date: Thu, 6 Feb 2020 10:58:24 +0800 Message-ID: <20200206025825.22934-6-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200206025825.22934-1-yanaijie@huawei.com> References: <20200206025825.22934-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