Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1994271ybb; Sun, 29 Mar 2020 19:23:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsfom8syUBep0QH9dClPXxIbbRb3RjDgNh0G3nc8dZl+r4Caiq/8wsyHWcPLTeMY0kChH/M X-Received: by 2002:a4a:950b:: with SMTP id m11mr8246839ooi.83.1585534996616; Sun, 29 Mar 2020 19:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585534996; cv=none; d=google.com; s=arc-20160816; b=VayTLZpL1mCrybckJmrmIpBWl50iv9nFWJHig7wH9sK776UdWK4mZINdpIJUVSpKg9 UJa26/hLnOJw+WAvDEVye78EYY6tgyhxVmFAENW+nxHRLmr6h3s9LjzhVRyUnVEzuiZr lRWaesP2nijbGr28QTXrTJHcptHoeRb5fJFhlBhn1STgc1A3t8J36+NLvHKtiD6mWlg0 02uFrTbGfhULe1d68CUjg9wrCi1CTbG6RqRoVsgQrEnbG2J4qyjMUGiyf6eMR6xJgT/C sn9Eq+L3P2rir0BYiy+osmpE9psS0KAh/5lfxhqG66eKpBTkTN8dPrXysWYVM+CjDjcN UwVg== 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=1b72q0wQeoFuKw1AyKExPiVQ6Kd+Ajgtr2ieC83aq2o=; b=Rrlstlley9k1B7dAu0IyJCYTho+rNcJ91FAmWoSrPgL0LPTEwUl6KObLL5lASU9qJ7 Phy4V6TZERY/f/06GiV3RTq+wxSLEkZRBjCrHNJpSQkqe9KItsIuMTtkm2aSbBa+ZMfP l/khXJB0vKnGCFliS692TIlu0oIaddeN2hq5EXelyG/G18YIhkBEnUZ6I9oR3QZdLDjq cwDhuD8lwHWZtP/B4NopGwqIJLqS7H3M+h/TRF1ehVKa8hYLeEqdOHxtepNUl0Q55Ynu AytMtuk6c3KQQPXMVqs5C7PZWe8vLOdn1PEpqnbCVE/JuCl8jd77hOCJumbZEDv6lLLA IWMA== 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 q7si5405401otk.77.2020.03.29.19.23.04; Sun, 29 Mar 2020 19:23:16 -0700 (PDT) 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 S1729039AbgC3CWm (ORCPT + 99 others); Sun, 29 Mar 2020 22:22:42 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12212 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728976AbgC3CWg (ORCPT ); Sun, 29 Mar 2020 22:22:36 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 78D72942388DF4EB45FC; Mon, 30 Mar 2020 10:22:33 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Mar 2020 10:22:23 +0800 From: Jason Yan To: , , , , , , , , , CC: , , , Jason Yan Subject: [PATCH v5 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized Date: Mon, 30 Mar 2020 10:20:22 +0800 Message-ID: <20200330022023.3691-6-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200330022023.3691-1-yanaijie@huawei.com> References: <20200330022023.3691-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 24ad34641869..6c46f24cc53d 100644 --- a/arch/powerpc/mm/nohash/kaslr_booke.c +++ b/arch/powerpc/mm/nohash/kaslr_booke.c @@ -382,8 +382,10 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size) unsigned long kernel_sz; if (IS_ENABLED(CONFIG_PPC64)) { - if (__run_at_load == 1) + if (__run_at_load == 1) { + kaslr_late_init(); return; + } /* Get the first memblock size */ early_get_first_memblock_info(dt_ptr, &size); -- 2.17.2