From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 053101C07DB; Tue, 15 Oct 2024 13:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728997324; cv=none; b=JNptSJtFi884nFPDl8sMWNOk7cG2liCN+Qwz7Vh1oXRFmZI2qG1XIOLHoGzh6+YNwZzBRMTxMQEPmwWqtUNa/hdbqfxMUD1OzvrWQ/3CUGHFyFR2OnQ5G17Yvr5YNpKRNeMkHqpmOVy3vI9sq/qJz8BxR1RY/oiKGHd3JuAeX/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728997324; c=relaxed/simple; bh=gkj6J94MCwABJ4ouw2GGlLkdBYC9qBrA7M5Mgqe7blk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LTFHeg4JKleBmoTldlvG8tXTNZLObbATE2oR1HXeUp+RjEINNcvgSeKKw3nst4Igp4P+1fZNgqphO+SqX7I2dPIiybzKFqsGPDIHskyLl+58SwEA+hldkhh9Cadr6FpPMCaLq39grBE97NOI5u6T29kyFMEiI3m9coySpfkVMPM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CdMjDDIq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CdMjDDIq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76307C4CEC6; Tue, 15 Oct 2024 13:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728997323; bh=gkj6J94MCwABJ4ouw2GGlLkdBYC9qBrA7M5Mgqe7blk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdMjDDIqnOmXQiUmwbxy6K37vThbpbtvjONJB4j7CzzcmtL1RpvHcNLbdVhiwHmt3 HdthRkRe5jpShMkKJXWp1NNCe+rOQRknHtBewj9n1PdeMT1P0HF+SpNUvyRVFq1BdK 2nEO4GVcTEfgTI7PkM6rKgOHNmHLNniX28Zo/T24= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Juergen Gross , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Sasha Levin Subject: [PATCH 5.10 133/518] xen: use correct end address of kernel for conflict checking Date: Tue, 15 Oct 2024 14:40:37 +0200 Message-ID: <20241015123922.129097460@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015123916.821186887@linuxfoundation.org> References: <20241015123916.821186887@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross [ Upstream commit fac1bceeeb04886fc2ee952672e6e6c85ce41dca ] When running as a Xen PV dom0 the kernel is loaded by the hypervisor using a different memory map than that of the host. In order to minimize the required changes in the kernel, the kernel adapts its memory map to that of the host. In order to do that it is checking for conflicts of its load address with the host memory map. Unfortunately the tested memory range does not include the .brk area, which might result in crashes or memory corruption when this area does conflict with the memory map of the host. Fix the test by using the _end label instead of __bss_stop. Fixes: 808fdb71936c ("xen: check for kernel memory conflicting with memory layout") Signed-off-by: Juergen Gross Tested-by: Marek Marczykowski-Górecki Reviewed-by: Jan Beulich Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- arch/x86/xen/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 1f80dd3a2dd4a..629c94d1ab24c 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -856,7 +856,7 @@ char * __init xen_memory_setup(void) * to relocating (and even reusing) pages with kernel text or data. */ if (xen_is_e820_reserved(__pa_symbol(_text), - __pa_symbol(__bss_stop) - __pa_symbol(_text))) { + __pa_symbol(_end) - __pa_symbol(_text))) { xen_raw_console_write("Xen hypervisor allocated kernel memory conflicts with E820 map\n"); BUG(); } -- 2.43.0