From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43BB7C4BA09 for ; Wed, 26 Feb 2020 02:44:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 120B02082F for ; Wed, 26 Feb 2020 02:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730172AbgBZCoY (ORCPT ); Tue, 25 Feb 2020 21:44:24 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10691 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729045AbgBZCoY (ORCPT ); Tue, 25 Feb 2020 21:44:24 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A7E0BFFE36A0D8364CC9; Wed, 26 Feb 2020 10:44:20 +0800 (CST) Received: from [127.0.0.1] (10.173.221.195) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Wed, 26 Feb 2020 10:44:10 +0800 Subject: Re: [PATCH v3 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized To: Christophe Leroy , , , , , , , , , CC: , References: <20200206025825.22934-1-yanaijie@huawei.com> <20200206025825.22934-6-yanaijie@huawei.com> <0f778e1c-5e29-e600-1cf0-aeb3e1a6fe08@c-s.fr> From: Jason Yan Message-ID: Date: Wed, 26 Feb 2020 10:44:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <0f778e1c-5e29-e600-1cf0-aeb3e1a6fe08@c-s.fr> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.173.221.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/2/20 21:49, Christophe Leroy 写道: > > > Le 06/02/2020 à 03:58, Jason Yan a écrit : >> The original kernel still exists in the memory, clear it now. > > No such problem with PPC32 ? Or is that common ? > PPC32 did this in relocate_init() in fsl_booke.c because PPC32 will not reach kaslr_early_init for the second pass after relocation. Thanks, Jason > Christophe > >> >> 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; >> > > .