Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp673062img; Fri, 22 Mar 2019 06:19:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqtpB+ggwqzXq09TKCzRsOyzwi8DGdQUqIbkRhC6dnyCQXW+VRyqcZRrmBoNzmyiOjiT4/ X-Received: by 2002:a62:342:: with SMTP id 63mr9191886pfd.80.1553260794815; Fri, 22 Mar 2019 06:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553260794; cv=none; d=google.com; s=arc-20160816; b=nv2u6J6fGZHASTjmCIWT4CnfwAK7z2pN14Svl4ykOoD0MUlYfdISdwz/opKCCzqyDe 5zXrKDV+txWgtYAHdP7WDFYokH6aAbmCFl0IU8uKdJRICMZBEG96IADV+/se11heyKCu ikb03H/hcZ7WyCovYk+UI2ak1B/jkqkB8cIQx8pND59IieY7x8LoNOInWJ+oywhvnU26 cgFvWSmGgWHK+d0+jT6YRECWiy1hi2E3NEMRn8vutTdNJCbDn5kZ5QQQ9+/3QB7ynBe4 Ie66Es3JWDdjn4Zf/W0QckXfYNZyaE6O9ZYznswjyNF2wQynwgtDhl0WNE9R9Bx3exTm EVpQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d7zvn1BRVlyJpXtVo8jfz+0I/unDC/mtu70k3cZLd+g=; b=LDWD19enCG+eJke0GTnk7WItoi+sRc5+cYsT2SIfQEhUFbbpHLtPHpl4yUeNnLq5zg UJYwz21O2J7jlYVEgSfVjPT746A7N4lrW0kvjrjrWTZ2cotvyMiUk2eozKZeWLp6DKBL wOunLi8gUzfKAKJGzg8FUXsT0ntcDU65VCvaMgQSImwijkGdXJoPfgE2S0rjULIORWsq p25mDQ0Ux9L4GhojuhWIQoHMXPI9sKhl7dXF/dDrJVQ05WPMld5LCHEhelJxtgxcf61i 8EL5lcGjvdZVQxJ/IftSMU0PsRJ+gj5vSWpUM+TPERD2TiTmnDDQnsvkvF7ivZzWGt7K D12g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p3DRl5y2; 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 r5si7022876plo.40.2019.03.22.06.19.40; Fri, 22 Mar 2019 06:19:54 -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; dkim=pass header.i=@kernel.org header.s=default header.b=p3DRl5y2; 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 S1728902AbfCVLXA (ORCPT + 99 others); Fri, 22 Mar 2019 07:23:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:49742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728885AbfCVLW4 (ORCPT ); Fri, 22 Mar 2019 07:22:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C74B3218D4; Fri, 22 Mar 2019 11:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253775; bh=3qBO9WZKuncfGYf8kaV0C4vwlFSS6x3S7pgFlWyUuwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p3DRl5y2WDnY+L6AEd5+n4kXg+W0oRVuhXwNdGZuQajX8I9SklDo9KUZVVf7T3WfX 57cU1VIHq/eeUAJHqyKSMKSuSBwyCzFgm830zWuMG7cqxzJsQ51j3Wfjl0/ktDDVX6 DFNBO3mBNKzwn3Zgh/H1VN7pjHFLhncUvQ4DptSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Young , Kairui Song , Borislav Petkov , AKASHI Takahiro , Andrew Morton , Ard Biesheuvel , bhe@redhat.com, David Howells , erik.schmauss@intel.com, fanc.fnst@cn.fujitsu.com, "H. Peter Anvin" , Ingo Molnar , kexec@lists.infradead.org, lenb@kernel.org, linux-acpi@vger.kernel.org, Philipp Rudo , rafael.j.wysocki@intel.com, robert.moore@intel.com, Thomas Gleixner , x86-ml , Yannik Sembritzki , Sasha Levin Subject: [PATCH 3.18 068/134] x86/kexec: Dont setup EFI info if EFI runtime is not enabled Date: Fri, 22 Mar 2019 12:14:41 +0100 Message-Id: <20190322111214.990612455@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 2aa958c99c7fd3162b089a1a56a34a0cdb778de1 ] Kexec-ing a kernel with "efi=noruntime" on the first kernel's command line causes the following null pointer dereference: BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 #PF error: [normal kernel read fault] Call Trace: efi_runtime_map_copy+0x28/0x30 bzImage64_load+0x688/0x872 arch_kexec_kernel_image_load+0x6d/0x70 kimage_file_alloc_init+0x13e/0x220 __x64_sys_kexec_file_load+0x144/0x290 do_syscall_64+0x55/0x1a0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Just skip the EFI info setup if EFI runtime services are not enabled. [ bp: Massage commit message. ] Suggested-by: Dave Young Signed-off-by: Kairui Song Signed-off-by: Borislav Petkov Acked-by: Dave Young Cc: AKASHI Takahiro Cc: Andrew Morton Cc: Ard Biesheuvel Cc: bhe@redhat.com Cc: David Howells Cc: erik.schmauss@intel.com Cc: fanc.fnst@cn.fujitsu.com Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: kexec@lists.infradead.org Cc: lenb@kernel.org Cc: linux-acpi@vger.kernel.org Cc: Philipp Rudo Cc: rafael.j.wysocki@intel.com Cc: robert.moore@intel.com Cc: Thomas Gleixner Cc: x86-ml Cc: Yannik Sembritzki Link: https://lkml.kernel.org/r/20190118111310.29589-2-kasong@redhat.com Signed-off-by: Sasha Levin --- 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 ca05f86481aa..3e22751382c3 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.19.1