Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp21095imu; Thu, 24 Jan 2019 18:54:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Cq84w47gfCpeBfqFMxrGbgXjqGyc+RgrQ0PSZFLj7IkEDGXe5ID7vY62IgQ0mt/dThalF X-Received: by 2002:a17:902:b18b:: with SMTP id s11mr9100119plr.56.1548384876611; Thu, 24 Jan 2019 18:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548384876; cv=none; d=google.com; s=arc-20160816; b=T+z4FrZtDgYg8PO/csgVlDDJN+fykfOGANTsMJwbBxTIdjAN4moofgCofaRWVl3gdI sFKyE9ETSVBgZA0SeoXpf5rdNIrf64yDHc6PsGZo5HB/fFClRmFud7cG9wqfSUGXknKg piRsqhhcVeZNFYXxlmZbX2L9lTCEEJRC7yq3SaSctUoAiQTGhvjnIcX83bpVzRmvJ6an 627Z35wEUO33RGC8QRGkm8VKbGUI98HvBmLpiwuPLiu466HS4gqOeTsgVSap/GVLehbR 56NZtguY1jxE1DIuhUl9yCkrEvZjagP6MmY3eKEmcUiYtyTJ61jZW6ry+IoqFK2guwhs w+yQ== 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=TW0RpconO9F6f5IILODbViuoaj8nsWUdN7fJJRYNfvA=; b=bU++PJCZRRCOfWwXCxelyjBDd2YHt6bJfPi6UWOHZTwlIOvJL6p7H3HFwDyboYE7qD kHqeZB9LEa2E4jNNrdWjuzHD13Sm4+AptSPqo9W9mjjCzyUSTv7uYcf2+DImt6Z6cJsy CXIFQu7F2Kk63LR0aLIBT831o+PhugB0raad/nVESSL8ycAWBySlkt+JX6cOoQosOQe4 GOe7rZBx7d7EF/NcHh18ED+Ow974Lty584wNnEP2li3FmRhDmei1yObglpNgehPDF1rY 7nWKIffDRUCpIE0EKatbwT3CGm2Ga03r9D3kFGRUUK2+P5PhitCg8xJ5TVC5OFEzh/pR A8Ag== 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 j14si2135876pgg.44.2019.01.24.18.54.20; Thu, 24 Jan 2019 18:54:36 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728530AbfAYCx7 (ORCPT + 99 others); Thu, 24 Jan 2019 21:53:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbfAYCx7 (ORCPT ); Thu, 24 Jan 2019 21:53:59 -0500 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 7ED6EC05FF7F; Fri, 25 Jan 2019 02:53:58 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-43.pek2.redhat.com [10.72.12.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 409667B534; Fri, 25 Jan 2019 02:53:49 +0000 (UTC) Date: Fri, 25 Jan 2019 10:53:46 +0800 From: Dave Young To: Kairui Song Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, bhe@redhat.com, kexec@lists.infradead.org, akpm@linux-foundation.org, robert.moore@intel.com, erik.schmauss@intel.com, rafael.j.wysocki@intel.com, lenb@kernel.org, fanc.fnst@cn.fujitsu.com, linux-acpi@vger.kernel.org Subject: Re: [PATCH v3 1/3] x86, kexec_file_load: Don't setup EFI info if EFI runtime is not enabled Message-ID: <20190125025346.GA19241@dhcp-128-65.nay.redhat.com> References: <20190118111310.29589-1-kasong@redhat.com> <20190118111310.29589-2-kasong@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190118111310.29589-2-kasong@redhat.com> User-Agent: Mutt/1.9.5 (2018-04-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.31]); Fri, 25 Jan 2019 02:53:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/18/19 at 07:13pm, Kairui Song wrote: > Currently with "efi=noruntime" in kernel command line, calling > kexec_file_load will raise below problem: > > [ 97.967067] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 > [ 97.967894] #PF error: [normal kernel read fault] > ... > [ 97.980456] Call Trace: > [ 97.980724] efi_runtime_map_copy+0x28/0x30 > [ 97.981267] bzImage64_load+0x688/0x872 > [ 97.981794] arch_kexec_kernel_image_load+0x6d/0x70 > [ 97.982441] kimage_file_alloc_init+0x13e/0x220 > [ 97.983035] __x64_sys_kexec_file_load+0x144/0x290 > [ 97.983586] do_syscall_64+0x55/0x1a0 > [ 97.983962] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > When efi runtime is not enabled, efi memmap is not mapped, so just skip > EFI info setup. > > Suggested-by: Dave Young > Signed-off-by: Kairui Song > --- > arch/x86/kernel/kexec-bzimage64.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c > index 2c007abd3d40..097f52fb02e3 100644 > --- a/arch/x86/kernel/kexec-bzimage64.c > +++ b/arch/x86/kernel/kexec-bzimage64.c > @@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, > struct efi_info *current_ei = &boot_params.efi_info; > struct efi_info *ei = ¶ms->efi_info; > > + if (!efi_enabled(EFI_RUNTIME_SERVICES)) > + return 0; > + > if (!current_ei->efi_memmap_size) > return 0; > > -- > 2.20.1 > Patch 1/3 looks good to me, 2-3 should depend on Chao's early rsdp parsing according to Boris. Acked-by: Dave Young Thanks Dave