Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp447487yba; Thu, 9 May 2019 00:02:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZzQItQYiJ2PGffwLzaTn3F1/1bgjL3ABMixTIPc6f1RfuhYYDlpgy6NFWr1rqmQap0SIM X-Received: by 2002:a62:d44a:: with SMTP id u10mr2759806pfl.227.1557385355418; Thu, 09 May 2019 00:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557385355; cv=none; d=google.com; s=arc-20160816; b=qYq/tNm4cn0b2SXV2tLLGYkEr4jUahyAHVeWcW4oviWcU/IM1sAhAnH9guZr/ohzpH sq6suB8MIxh3RltVjmKFfEKgdwCrU6MvNs0uuYEeZGUEFrQAFoWA3Lf5pu9YnMjp3q4z K3pnUZgEYMov13955kpIq7xSn7a6a77e2/MyROwcGCl5zU0z3nPB/nMdR2KDvbYkpqea 4CrcYGb/GR0nxdIrEkAhK5yajFy48Ya641blNUFtCcANKu/7hbolwg3xcuPdPtN2lIyu azX/NJBQbcq877i4U22TD6nJNrmfU8uzezW2KXaqQzFEQBbSmhmNxgWx81mk/j8MPFE9 MuYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=R/e5XSIifitMw0oxuQumIAWRcuQ6xKXyLMTBMmXGd3Y=; b=wu8t23ox0uiDuM77lLbpv7u7DKyqV7M1uAb5EDDs/qG5MFmFbPiJBNnqoLSrN4JEyx sqzyooQoWE80zb4qlA3XrOMU4dD/4yaM8Zt4G1PblUkDY7SDGCJ8KqfyrIH8XNHRZocZ YSTjDMA+QQhw+vQPi1anmAPlwkNnGQ/qO0/7q5nAFVyg/XmrlWx2pxT3E88PGzn1/Af1 yQupmFOWb4xM8Je1FRgkp0jheNk5H3hh7G/TclsgXSHjcj8l/2F7LDQJV78k7mIqrdvp 28sHMx7IfxusY1hYKTusEluby/Se0ItGlQy1kgxexo5VqeQsBAaTd2+eXyq5rAGrIxXh 8UAA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si1826199pgm.20.2019.05.09.00.02.18; Thu, 09 May 2019 00:02:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbfEIHBS (ORCPT + 99 others); Thu, 9 May 2019 03:01:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56846 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725908AbfEIHBR (ORCPT ); Thu, 9 May 2019 03:01:17 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 997EB3097035; Thu, 9 May 2019 07:01:17 +0000 (UTC) Received: from localhost (ovpn-12-17.pek2.redhat.com [10.72.12.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B97A5D9D1; Thu, 9 May 2019 07:01:13 +0000 (UTC) Date: Thu, 9 May 2019 15:01:11 +0800 From: Baoquan He To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, mingo@kernel.org, bp@alien8.de, hpa@zytor.com, kirill.shutemov@linux.intel.com, x86@kernel.org, dyoung@redhat.com Subject: Re: [PATCH v4 2/3] x86/kexec/64: Error out if try to jump to old 4-level kernel from 5-level kernel Message-ID: <20190509070111.GE24922@MiWiFi-R3L-srv> References: <20190509013644.1246-1-bhe@redhat.com> <20190509013644.1246-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190509013644.1246-3-bhe@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 09 May 2019 07:01:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/09/19 at 09:36am, Baoquan He wrote: > If the running kernel has 5-level paging activated, the 5-level paging > mode is preserved across kexec. If the kexec'ed kernel does not contain > support for handling active 5-level paging mode in the decompressor, the > decompressor will crash with #GP. > > Prevent this situation at load time. If 5-level paging is active, check the > xloadflags whether the kexec kernel can handle 5-level paging at least in > the decompressor. If not, reject the load attempt and print out error > message. > > Signed-off-by: Baoquan He > Acked-by: Kirill A. Shutemov > --- > arch/x86/kernel/kexec-bzimage64.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c > index 22f60dd26460..858cc892672f 100644 > --- a/arch/x86/kernel/kexec-bzimage64.c > +++ b/arch/x86/kernel/kexec-bzimage64.c > @@ -321,6 +321,11 @@ static int bzImage64_probe(const char *buf, unsigned long len) > return ret; > } > > + if (!(header->xloadflags & XLF_5LEVEL) && pgtable_l5_enabled()) { > + pr_err("Can not jump to old 4-level kernel from 5-level kernel.\n"); Check the old thread again, found Thomas also had comment about this error message. Just forgot updating it. Will update it with a new one. > + return ret; > + } > + > /* I've got a bzImage */ > pr_debug("It's a relocatable bzImage64\n"); > ret = 0; > -- > 2.17.2 >