Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1109470rwi; Thu, 27 Oct 2022 11:15:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hWm/k7HHPVkcxO5IgTGpnoEwNRBMwoFQtwSfx+0P9yCH31O+C0dWAyOEEgpVei2v0ZwE2 X-Received: by 2002:a63:5762:0:b0:43c:c1b5:3e75 with SMTP id h34-20020a635762000000b0043cc1b53e75mr42253280pgm.380.1666894551561; Thu, 27 Oct 2022 11:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666894551; cv=none; d=google.com; s=arc-20160816; b=AX6VlLPKAXnK7OXa2JQSrPw4VgJQ8TDu7In3/jZtnlwjQMIifrMUAOm0QdIzDf/sfF 4XBP9oCa3vmDSUe9izEmurxw5+ZJMH2O2074/gFK2yPEoNPO1qGVweG+XzKpxc962Gb6 feN4ELGdBOHrVaYovelFSY7fcHgQrxheQDP8v3cnRu2Xkg8rK95wlxrYGCKI/1jOFBI8 JDvoA9HJxP9kFy2sFzOw63iEOX9WxtR1a4lqUAH2GW8T2B6uO8+9vNB/syJcwdmVWn3X WgPA5kp6iqxmfrfAZTtaIKSzOvkw3EmAthdZuOZ4ai1Aot+GRjE/RFklPZTvr6m0oHm3 eXiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=O+CnI8JPuYtMDTEmLAtzTr/5MVYa4V/4mL/8SNYtbqw=; b=hZ2Lp2RWyW2L1NjSZ328L8UZxrGkyWqMguisAzoB8I86ctLdsaJAATJlkF+VxOX5M5 9t/I+y0/lVqEpl3UE2+euRHnyQqszJ/1loJtHTonJtmSEek0+I1oXHZvEVfEZ8V3ApnD uHW1KDWJufoF44KyaQ8XZv9oBB7NnXFu9uO6ctDS9DXY9SjMqLhhJuyaRzh3W9UTaO6N ldmF7GCj/aI16v3yE44yid9f6RDwuiHitoxBBKZ4ojZIFzPLgxluS9trckZD0oW0KoL3 a8PS9GJmhLMNI61gymgzjJ7vtFM0wN73DYorydA7HOjdaayrl0UoKnpbiAJBEa+cEFhT 4apQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a634f4b000000b0043a1129e476si2364592pgl.340.2022.10.27.11.15.40; Thu, 27 Oct 2022 11:15:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236077AbiJ0SAK (ORCPT + 99 others); Thu, 27 Oct 2022 14:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235962AbiJ0R7Z (ORCPT ); Thu, 27 Oct 2022 13:59:25 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 242E3180AD9; Thu, 27 Oct 2022 10:59:17 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id eea9195a9de4c2bc; Thu, 27 Oct 2022 19:59:16 +0200 Received: from kreacher.localnet (unknown [213.134.169.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 4C79E66D83D; Thu, 27 Oct 2022 19:59:15 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Bob Moore Subject: [PATCH 03/11] ACPICA: Check that EBDA pointer is in valid memory Date: Thu, 27 Oct 2022 19:50:06 +0200 Message-ID: <10171725.nUPlyArG6x@kreacher> In-Reply-To: <4756726.GXAFRqVoOG@kreacher> References: <4756726.GXAFRqVoOG@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.169.45 X-CLIENT-HOSTNAME: 213.134.169.45 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvgedrtdeggdduudejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepledtieekkeekveeikeetgffgteeuteefjeevjeegudelvdduheeiuedvieehieevnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepvddufedrudefgedrudeiledrgeehnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepvddufedrudefgedrudeiledrgeehpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeefpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhosggvrhhtrdhmohhorhgvsehinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vit Kabele ACPICA commit cc9e7763ceb2e2649fe3422130416d84a3c6854a If the memory at 0x40e is uninitialized, the retrieved physical_memory address of EBDA may be beyond the low memory (i.e. above 640K). If so, the kernel may unintentionally access the VGA memory, that might not be decoded or even present in case of virtualization. Link: https://github.com/acpica/acpica/commit/cc9e7763 Signed-off-by: Vit Kabele Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- drivers/acpi/acpica/tbxfroot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Index: linux-pm/drivers/acpi/acpica/tbxfroot.c =================================================================== --- linux-pm.orig/drivers/acpi/acpica/tbxfroot.c +++ linux-pm/drivers/acpi/acpica/tbxfroot.c @@ -139,7 +139,11 @@ acpi_find_root_pointer(acpi_physical_add /* EBDA present? */ - if (physical_address > 0x400) { + /* + * Check that the EBDA pointer from memory is sane and does not point + * above valid low memory + */ + if (physical_address > 0x400 && physical_address < 0xA0000) { /* * 1b) Search EBDA paragraphs (EBDA is required to be a * minimum of 1K length)