Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3067457imm; Mon, 24 Sep 2018 15:17:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV60CaKXDZ3WG+f7AeDB92vLTsAp9tQtOhbFDpQk/Le+xVwJgxMWi/CXq7GaIG63dxNAYRK/h X-Received: by 2002:a63:350f:: with SMTP id c15-v6mr644335pga.206.1537827421433; Mon, 24 Sep 2018 15:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537827421; cv=none; d=google.com; s=arc-20160816; b=B2pGpEXIyZfuO0fcAZfw9nCmSvQQHEDV+8WYvYQQLZA8CRqTwEsJyrHUvIRUM4Ccg1 9qjzA19z4gfg7hmvp7EGas+cEVfftAJF27vA4fjPh/PUpBpYGVJhKlhRQjSEVhgIUnUx XxEXluoz7axG1RsXvDTUy+VRbR5/TvRobXyVvujDra+M/WGbkmygG2nwBjkZclluexDR Igv8g//wpR41GKx/jfyj/eFWlFzLlXaO/7pY18eh9NRF23Fq0lexZOW0UE3Y/p9sQSx6 V+5CKlmBctZwqqJS0XTzNFpFK3FUg60sHdul4YoY1MWCighUTpITFw8LSztx66B6HHoL m4dw== 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:cc:to:from :subject:dkim-signature; bh=9xXfa0xbMIQYEZSbYs2NWea/6WUVJ2uPuyLK5FMaomo=; b=G0DzUpnY9SJ2BvZ37n/AyrGfzxwnLhoAq2WtiKXLbd7MBZaI9D8TPGnUYtMImAGhLa cee293dJEsfj+yZnl4JqhU60BtMeIm9kzWFqpQJqFpObVw3gI2SJu5V73Z4kbx7wd12b WnKyubon310e7z/kTZwzFnUIieqcds85vRxT469AKPoijEsuPyXLmVX9cU5kwlu+wjh4 5rE+LkNS2GOd+uLel/MnsaH3Bij6rtKcRGciEhkJJyNpfwbDUke74o3aXsphR51RpVnc 52qEpyeKsrOHbM4qcbPP4gmXVU0xGqxT3i+TxMN9XMrGmDcfggYma1bW/DugnnvfLWJQ V9xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2SmDbQ78; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si466045plf.0.2018.09.24.15.16.46; Mon, 24 Sep 2018 15:17:01 -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=2SmDbQ78; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728279AbeIYETM (ORCPT + 99 others); Tue, 25 Sep 2018 00:19:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:45884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725743AbeIYETM (ORCPT ); Tue, 25 Sep 2018 00:19:12 -0400 Received: from localhost (unknown [69.71.4.100]) (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 5119F2145D; Mon, 24 Sep 2018 22:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1537827289; bh=tiZS6N7uqSbh27UmYU2/S67qs7DpAyPZrBY6KqfIpnA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=2SmDbQ78iBd3SHG1M2sKKk/wiKXMzWS2E/RuaYUfJlkabmv1No1jic6z8dkdpFUhG I40vC98K4fCHQJgm4hSl8ZmAjL8J3mUn+dBhkOClZuP5fe3waHDhg5VfhHR6btW7f4 9lJa+lV520jDksyDYuh2nzIK6nZoDOclVVcqc4S8= Subject: [PATCH 1/3] x86/kexec: Correct KEXEC_BACKUP_SRC_END off-by-one error From: Bjorn Helgaas To: Lianbo Jiang Cc: Vivek Goyal , linux-kernel@vger.kernel.org, kexec@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, akpm@linux-foundation.org, dan.j.williams@intel.com, thomas.lendacky@amd.com, baiyaowei@cmss.chinamobile.com, tiwai@suse.de, bp@suse.de, brijesh.singh@amd.com, dyoung@redhat.com, bhe@redhat.com Date: Mon, 24 Sep 2018 17:14:46 -0500 Message-ID: <153782728660.130337.15572354657557294628.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <153782698067.130337.12079523922130875402.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <153782698067.130337.12079523922130875402.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas The only use of KEXEC_BACKUP_SRC_END is as an argument to walk_system_ram_res(): int crash_load_segments(struct kimage *image) { ... walk_system_ram_res(KEXEC_BACKUP_SRC_START, KEXEC_BACKUP_SRC_END, image, determine_backup_region); walk_system_ram_res() expects "start, end" arguments that are inclusive, i.e., the range to be walked includes both the start and end addresses. KEXEC_BACKUP_SRC_END was previously defined as (640 * 1024UL), which is the first address *past* the desired 0-64KB range. Define KEXEC_BACKUP_SRC_END as (640 * 1024UL - 1) so the KEXEC_BACKUP_SRC region is [0-0xffff], not [0-0x10000]. Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call") Signed-off-by: Bjorn Helgaas --- arch/x86/include/asm/kexec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index f327236f0fa7..5125fca472bb 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -67,7 +67,7 @@ struct kimage; /* Memory to backup during crash kdump */ #define KEXEC_BACKUP_SRC_START (0UL) -#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */ +#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */ /* * CPU does not save ss and sp on stack if execution is already