Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4246936ybc; Fri, 15 Nov 2019 01:14:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzWaetXDBuHQOPuCg9JuzWxOSchzOQ0bS7yqC3civn8id3L7gQTARnmG2+K5rZiEsx2yUHw X-Received: by 2002:a1c:2155:: with SMTP id h82mr12928634wmh.94.1573809254043; Fri, 15 Nov 2019 01:14:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573809254; cv=none; d=google.com; s=arc-20160816; b=UuL0+O5iF6wtO+S2bfhjKHuBR/HWL7Z58Zj5mv9otELTGjpvidCBkztka19VsS8OKx vJWa0NeMgW1YluYpAqMXkbdRx2AAKB+62KXXDAa6i82Fz46877g2E4cVB1KSI+4hvQKH YHE5wckHALcIOkJtCh/jI7S2uGva+3gBpBr1QlN3a2wDSYsheRG3uxw8V8yOVtvFIbdS J5o2sqwcJNG1O5awWSeNGfCDwgVs8SSjc/Cn1uCOwZ59oNqdPlQzEwb0+Czj90Dt0lw6 GfLyzjPHDv+MDwjQ9AKtEyZwiZe+tx3Vb+FqIvHYuZNJyVL/nHDRdZZYFrk+eE5F0nRn VKEA== 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=eqkwyMqJAUtjVv3b9wsIdD1ywxfS2H17DHkse7qBL3M=; b=KXNS73oL35ooGRgARiV9YbymAB1hXW2GjmSpLjdDcQCmx1TiVW2JCzerZMUzgmK+wf oyjbPVaXVrdOz+SRquzh1nVJpnDZF/+rlfNMxRSbhvc1whuIoODcYE2O8aGLc9lfVgSO 5fC0u/Ll3FNp9k0IzhBQbNCkSbC5CNWK5dAvYyjiO6F7+EOGcwRQ8Jrl4wZgpSKzHND+ 02UsfNowIsCRub226a0zYyvXsi9Fl8UuEB7AJFPs9kTX1k/vd1nNQfkmM8qU9Ey5mtWc PVofJciaLmvm3OcKMpRZNrvhx7dV2wBYQBos4Efsg05vkDtj935n1lu3rzVREmC1Dg8W 062Q== 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 i39si6902367eda.88.2019.11.15.01.13.48; Fri, 15 Nov 2019 01:14:14 -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 S1727324AbfKOJLE (ORCPT + 99 others); Fri, 15 Nov 2019 04:11:04 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:32770 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727218AbfKOJLE (ORCPT ); Fri, 15 Nov 2019 04:11:04 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0F9996980AC99CA681F2; Fri, 15 Nov 2019 17:11:03 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Fri, 15 Nov 2019 17:10:56 +0800 From: Jason Yan To: , , , , , , , , CC: , , Jason Yan Subject: [PATCH 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized Date: Fri, 15 Nov 2019 17:32:08 +0800 Message-ID: <20191115093209.26434-6-yanaijie@huawei.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191115093209.26434-1-yanaijie@huawei.com> References: <20191115093209.26434-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 513f4616e92a..323fe25e8e08 100644 --- a/arch/powerpc/mm/nohash/kaslr_booke.c +++ b/arch/powerpc/mm/nohash/kaslr_booke.c @@ -377,8 +377,10 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size) #ifdef CONFIG_PPC64 unsigned int *__run_at_load = (unsigned int *)(KERNELBASE + 0x5c); - if (*__run_at_load == 1) + if (*__run_at_load == 1) { + kaslr_late_init(); return; + } *__run_at_load = 1; -- 2.17.2