From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Bob Moore <robert.moore@intel.com>
Subject: [PATCH 04/11] ACPICA: Do not touch VGA memory when EBDA < 1ki_b
Date: Thu, 27 Oct 2022 19:50:59 +0200 [thread overview]
Message-ID: <1914944.PYKUYFuaPT@kreacher> (raw)
In-Reply-To: <4756726.GXAFRqVoOG@kreacher>
From: Vit Kabele <vit@kabele.me>
ACPICA commit a36eda9631e84f271319c41288889dd5b1329369
The ACPICA code assumes that EBDA region must be at least 1ki_b in size.
Because this is not guaranteed, it might happen that while scanning the
memory for RSDP pointer, the kernel touches memory above 640ki_b.
This is unwanted as the VGA memory range may not be decoded or
even present when running under virtualization.
Link: https://github.com/acpica/acpica/commit/a36eda96
Signed-off-by: Vit Kabele <vit@kabele.me>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/acpica/tbxfroot.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
Index: linux-pm/drivers/acpi/acpica/tbxfroot.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpica/tbxfroot.c
+++ linux-pm/drivers/acpi/acpica/tbxfroot.c
@@ -114,6 +114,7 @@ acpi_find_root_pointer(acpi_physical_add
u8 *table_ptr;
u8 *mem_rover;
u32 physical_address;
+ u32 ebda_window_size;
ACPI_FUNCTION_TRACE(acpi_find_root_pointer);
@@ -145,24 +146,31 @@ acpi_find_root_pointer(acpi_physical_add
*/
if (physical_address > 0x400 && physical_address < 0xA0000) {
/*
- * 1b) Search EBDA paragraphs (EBDA is required to be a
- * minimum of 1K length)
+ * Calculate the scan window size
+ * The EBDA is not guaranteed to be larger than a ki_b and in case
+ * that it is smaller, the scanning function would leave the low
+ * memory and continue to the VGA range.
+ */
+ ebda_window_size = ACPI_MIN(ACPI_EBDA_WINDOW_SIZE,
+ 0xA0000 - physical_address);
+
+ /*
+ * 1b) Search EBDA paragraphs
*/
table_ptr = acpi_os_map_memory((acpi_physical_address)
physical_address,
- ACPI_EBDA_WINDOW_SIZE);
+ ebda_window_size);
if (!table_ptr) {
ACPI_ERROR((AE_INFO,
"Could not map memory at 0x%8.8X for length %u",
- physical_address, ACPI_EBDA_WINDOW_SIZE));
+ physical_address, ebda_window_size));
return_ACPI_STATUS(AE_NO_MEMORY);
}
mem_rover =
- acpi_tb_scan_memory_for_rsdp(table_ptr,
- ACPI_EBDA_WINDOW_SIZE);
- acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
+ acpi_tb_scan_memory_for_rsdp(table_ptr, ebda_window_size);
+ acpi_os_unmap_memory(table_ptr, ebda_window_size);
if (mem_rover) {
next prev parent reply other threads:[~2022-10-27 17:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 17:45 [PATCH 00/11] ACPICA: Upstream changes since ACPICA 20220331 Rafael J. Wysocki
2022-10-27 17:47 ` [PATCH 01/11] ACPICA: MADT: Add loong_arch-specific APICs support Rafael J. Wysocki
2022-10-27 17:48 ` [PATCH 02/11] ACPICA: Events: Support fixed PCIe wake event Rafael J. Wysocki
2022-10-27 17:50 ` [PATCH 03/11] ACPICA: Check that EBDA pointer is in valid memory Rafael J. Wysocki
2022-10-27 17:50 ` Rafael J. Wysocki [this message]
2022-10-27 17:51 ` [PATCH 05/11] ACPICA: iASL: Add CCEL table to both compiler/disassembler Rafael J. Wysocki
2022-10-27 17:52 ` [PATCH 06/11] ACPICA: Add a couple of new UUIDs to the known UUID list Rafael J. Wysocki
2022-10-27 17:54 ` [PATCH 07/11] ACPICA: Add support for FFH Opregion special context data Rafael J. Wysocki
2022-10-27 17:55 ` [PATCH 08/11] ACPICA: Improve warning message for "invalid ACPI name" Rafael J. Wysocki
2022-10-27 17:56 ` [PATCH 09/11] ACPICA: Add CXL 3.0 structures (CXIMS & RDPAS) to the CEDT table Rafael J. Wysocki
2022-10-27 17:57 ` [PATCH 10/11] ACPICA: IORT: Update for revision E.e Rafael J. Wysocki
2022-10-27 17:58 ` [PATCH 11/11] ACPICA: Finish support for the CDAT table Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1914944.PYKUYFuaPT@kreacher \
--to=rjw@rjwysocki.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robert.moore@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox