Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4366956ybv; Tue, 25 Feb 2020 18:45:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxlmPGytkgF8jV8DEIwwRl5fvl8zxWsF5cgJrjkqZNsvWiWERLuqsfPsbpi2egjZhIliHRj X-Received: by 2002:a9d:7593:: with SMTP id s19mr1219084otk.219.1582685118164; Tue, 25 Feb 2020 18:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582685118; cv=none; d=google.com; s=arc-20160816; b=WlWPsDu4GRKI+aY3OTX5N2rwybv0la+NpIu9K28mUyE3tB5UyQFrQX7/klpSGMOQ5N xs95V77fjYQtxzFxiJ5rcU7eP82aodk7wmN40wJkgLQ0IHqEkDF2RNDit96va3aU3miV A4BSYrWSuOfC3a7mVt36qnJ1K68s5+CQ2U+zjIRPsMwMzbDvic+elq/2Crb5kRakDuUy wqGwWYriQxgy20v6CS8KHltAthsUp6NpjuDTuA5gKoe+FUZtiE42lnNIbA0L/2zT6aeT 9gcSiPQfCxKUnvJ2fZtrxqSv9HlchLxHKPu3VNTD8JmL9vNIetCLSj6I5A6Hr8bjjYyf JF4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=BhLrQ6icIZ41wMetUCIft0GaCFNx/DHfK4aBKSSPGGk=; b=V29DoN34UgI2mBgg9pteFBRp4KN0YoRrzUd3t1reMX0QYH5otkslRdiSSncSW2MUsN USA1bQZ+V0SNpGKvKzomclgAYNeJiJsEuEV9ROFIoSh7wovfLozK/CPZRLgqzPq0Ey10 0r9TmA1asZctEQlYVlFdXw7h53XDexIZAIzhQMmMmtncAYfJ8NiqEX3NkuCnBpNPFb8b awa9CslkLAyAerwkl4jFBnMwrEDi8YvwhyaMhq/yyJTpxWp1L+NyjcQEebQeFiv3yobX Wn24d4gfJBpX9Yk/ZkCLmk4Z7VIWHos3lXS/AxdoLLQW7DbN/Raan3eLHHKLtNYb6SEV K+sg== 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 r82si353485oie.116.2020.02.25.18.45.05; Tue, 25 Feb 2020 18:45:18 -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 S1730135AbgBZCoY (ORCPT + 99 others); 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; >> > > .