Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp46591rdb; Thu, 21 Dec 2023 02:18:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZ9Q0YcUI8JAtRZOqSxSQQDN33byShspI7IpYsErU6hFpO7s0O/Pozv3S0JTBKyZfDHiu+ X-Received: by 2002:a50:f68f:0:b0:554:394b:7da0 with SMTP id d15-20020a50f68f000000b00554394b7da0mr40092edn.67.1703153898556; Thu, 21 Dec 2023 02:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703153898; cv=none; d=google.com; s=arc-20160816; b=dB0pdDoj/3xKexCvdo/9dqUBpZzhi0tYUvKIOYon1HJQNh/dkdyB6I2YCjjaPdq87v e3bcmbPdoFMbjuX7vSkKpxKyK5IvXSGcswkHiq4Ri8H+ITZrAlI3YkS6YdxifamPiimH kQuYLd6SskrcStdLpuP16+QUEO8eKbXYMOl3qMPZVCQOqdqYnuw+efYm6MkZXXjKVqXa VqKxLFP4FQX+hUcdZci8MhY0SIPXqNK/paoBj6T2Ymt4n7RgUCFlhtG/niqIJFolngwN p8G58t+Ea/3mrkumkggHMXNGLexXtV4A4WxOhfpcMUWEnCFtRZ63O3Q0TG2vx3Cr3kWk ugfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=M6NIr38DFBWDZyn+9oG1rPeiRckvDgmloLxDUP+lGxk=; fh=2/zCLfAyJyttkbcgrnwgj93pEThYyhgzYKi7rosfSwE=; b=0W63llyHzd1gacBjBOyLvYHxOnrl60imlsgwA4hAPM8/9D5i/OMqsmgrdZhAyr3mZl scPc+ysKOJAaOHHoKdqRtbkRtjGy1JUPVPrvRN121KehFMZAREhMRjGgK/r/ZDjEeMAb DKRbx+0V9pVKo2VtPSOH91IkwOgC7ydEaaUXH+/NWg4BWRRp/95s7mX0QP8AVKcA5/Ze kUnsrvJ0HBlcj0M0j3qPX5m/bTJvarPphvVV9GbMusmtZlp1Bm3+mqeH/fFzFI46ceDa ZtVV8T/E//CODbySoT+V7ealhksCnkEQjZyDKecNN5Uwmtad/5sVQfMomH+LdY7FE0Rk N0Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aUrvf1v6; spf=pass (google.com: domain of linux-kernel+bounces-8192-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8192-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cn20-20020a0564020cb400b0055386ca9e0bsi715307edb.286.2023.12.21.02.18.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 02:18:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8192-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aUrvf1v6; spf=pass (google.com: domain of linux-kernel+bounces-8192-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8192-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4F1AE1F22DC7 for ; Thu, 21 Dec 2023 10:18:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36A974F884; Thu, 21 Dec 2023 10:18:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aUrvf1v6" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5059E4F203 for ; Thu, 21 Dec 2023 10:18:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d3e05abcaeso4279605ad.1 for ; Thu, 21 Dec 2023 02:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703153888; x=1703758688; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=M6NIr38DFBWDZyn+9oG1rPeiRckvDgmloLxDUP+lGxk=; b=aUrvf1v6dXaeJi5Q+VXgTqFktHaI0S4bl7JejXh9wtIMAn3S/D1We8FqHWVJeBK4Ev 7ZyYv96HxRgW8g8K+4+s0pYQf9BR1We2/A1hYCKgq9Q+G1BMs0DLmaHVXbFneKt9ni6x WuzXTQrosNbgxdgWUstb2lf3oaGh2fAY+ZKbtDtgaURCuNOpsXx5/UU788LyoTGJdOjF Z9U5IQRFHWiOMrQVGuxa6gLrmT6cmnUZHRTc24IsdEuyi+yFn5C05FrJlGfN9uUStpyg iBrXnwR09amuJ3/mxodjiQQo0ht5IEsE7SolcwuqXraMyubDr3bPhB5+SIA18aBTXq5F 4LIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703153888; x=1703758688; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M6NIr38DFBWDZyn+9oG1rPeiRckvDgmloLxDUP+lGxk=; b=Xt5Q6qOMrZqxkPXGPCfSO4YqAuPyD3725XgiKqCq8Acf4i5hNHPxUD4HN3MxSAgEyI uUNxkfgJH/SJlja8oS47VvGhff4j4E3vK/l9/GbrNhVkEMcSmQHDh1izld215PWvicn8 o7s+aw34BeHrCh7FaMPSY43FVDi+8sdtYS+ikGy95qZjkfgjKD6AT+CiDjgdmurNp1Ok q0enlymSPkMzMvxktX6kmXcMdr+knz/GzqB4NQ8Twdtdgaygi7/zS80WQCmYYbR8PQlU yDeOnS4CHubHmHrhgVq90kijmvu/fBjD97S69VX6BU6XwJHEtjSA6ZEnhQm3W15YJMFN 3kpg== X-Gm-Message-State: AOJu0YzJUj4oNLifbgO6W4FsUw4b3nqfDyHQQtSZgDVP6vpQWC1s5J+1 yVqS6Tk8ED47aTz1xPG4+qeq+NjEb8U= X-Received: by 2002:a17:902:7848:b0:1d3:2d73:e1ae with SMTP id e8-20020a170902784800b001d32d73e1aemr8568885pln.109.1703153888223; Thu, 21 Dec 2023 02:18:08 -0800 (PST) Received: from code.. ([144.202.108.46]) by smtp.gmail.com with ESMTPSA id a17-20020a170902ee9100b001d0c418174fsm1255375pld.117.2023.12.21.02.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 02:18:08 -0800 (PST) From: Yuntao Wang To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Andrew Morton , Baoquan He , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Simon Horman , Bjorn Helgaas , Yuntao Wang Subject: [PATCH] x86/kexec: fix incorrect end address passed to kernel_ident_mapping_init() Date: Thu, 21 Dec 2023 18:17:02 +0800 Message-ID: <20231221101702.20956-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit kernel_ident_mapping_init() takes an exclusive memory range [pstart, pend) where pend is not included in the range, while res represents an inclusive memory range [start, end] where end is considered part of the range. Therefore, passing res->end directly to kernel_ident_mapping_init() is incorrect, the correct end address should be `res->end + 1`. Signed-off-by: Yuntao Wang --- arch/x86/kernel/machine_kexec_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 6f8df998890e..bc0a5348b4a6 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -44,7 +44,7 @@ static int mem_region_callback(struct resource *res, void *arg) struct init_pgtable_data *data = arg; return kernel_ident_mapping_init(data->info, data->level4p, - res->start, res->end); + res->start, res->end + 1); } static int -- 2.43.0