All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>,
	Robert Moore <robert.moore@intel.com>,
	Lv Zheng <lv.zheng@intel.com>,
	"David E . Box" <david.e.box@intel.com>
Cc: Lv Zheng <zetalog@gmail.com>,
	linux-acpi@vger.kernel.org, devel@acpica.org
Subject: [RFC PATCH v3 2/5] ACPICA: Tables: Do not validate signature for dynamic table load
Date: Thu, 18 May 2017 17:57:33 +0800	[thread overview]
Message-ID: <1978962b7d10bd212437816418884400dd498102.1495100623.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1495100623.git.lv.zheng@intel.com>

Windows seems to allow arbitrary table signatures for Load/load_table
opcodes:
  ACPI BIOS Error (bug): Table has invalid signature [PRAD] (0x44415250)
So this patch removes dynamic load signature checks. However we need to
find a way to avoid table loading against tables like MADT. This is not
covered by this commit.

This Windows behavior has been validated on link #1. An end user bug
report can also be found on link #2.

This patch also includes simple cleanup for static load signature check
code. Reported by Ye Xiaolong, Fixed by Lv Zheng.

Link: https://github.com/acpica/acpica/pull/121 [#1]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=118601 [#2]
Reported-by: Ye Xiaolong <xiaolong.ye@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/tbinstal.c | 28 ----------------------------
 drivers/acpi/acpica/tbxfload.c |  2 +-
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index ee74515..9d21296 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -222,34 +222,6 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 	(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 
 	if (reload) {
-		/*
-		 * Validate the incoming table signature.
-		 *
-		 * 1) Originally, we checked the table signature for "SSDT" or "PSDT".
-		 * 2) We added support for OEMx tables, signature "OEM".
-		 * 3) Valid tables were encountered with a null signature, so we just
-		 *    gave up on validating the signature, (05/2008).
-		 * 4) We encountered non-AML tables such as the MADT, which caused
-		 *    interpreter errors and kernel faults. So now, we once again allow
-		 *    only "SSDT", "OEMx", and now, also a null signature. (05/2011).
-		 */
-		if ((new_table_desc.signature.ascii[0] != 0x00) &&
-		    (!ACPI_COMPARE_NAME
-		     (&new_table_desc.signature, ACPI_SIG_SSDT))
-		    && (strncmp(new_table_desc.signature.ascii, "OEM", 3))) {
-			ACPI_BIOS_ERROR((AE_INFO,
-					 "Table has invalid signature [%4.4s] (0x%8.8X), "
-					 "must be SSDT or OEMx",
-					 acpi_ut_valid_nameseg(new_table_desc.
-							       signature.
-							       ascii) ?
-					 new_table_desc.signature.
-					 ascii : "????",
-					 new_table_desc.signature.integer));
-
-			status = AE_BAD_SIGNATURE;
-			goto unlock_and_exit;
-		}
 
 		/* Check if table is already registered */
 
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index b71ce3b..d81f442 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -206,7 +206,7 @@ acpi_status acpi_tb_load_namespace(void)
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
 		table = &acpi_gbl_root_table_list.tables[i];
 
-		if (!acpi_gbl_root_table_list.tables[i].address ||
+		if (!table->address ||
 		    (!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT)
 		     && !ACPI_COMPARE_NAME(table->signature.ascii,
 					   ACPI_SIG_PSDT)
-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
From: Lv Zheng <lv.zheng at intel.com>
To: devel@acpica.org
Subject: [Devel] [RFC PATCH v3 2/5] ACPICA: Tables: Do not validate signature for dynamic table load
Date: Thu, 18 May 2017 17:57:33 +0800	[thread overview]
Message-ID: <1978962b7d10bd212437816418884400dd498102.1495100623.git.lv.zheng@intel.com> (raw)
In-Reply-To: cover.1495100623.git.lv.zheng@intel.com

[-- Attachment #1: Type: text/plain, Size: 3100 bytes --]

Windows seems to allow arbitrary table signatures for Load/load_table
opcodes:
  ACPI BIOS Error (bug): Table has invalid signature [PRAD] (0x44415250)
So this patch removes dynamic load signature checks. However we need to
find a way to avoid table loading against tables like MADT. This is not
covered by this commit.

This Windows behavior has been validated on link #1. An end user bug
report can also be found on link #2.

This patch also includes simple cleanup for static load signature check
code. Reported by Ye Xiaolong, Fixed by Lv Zheng.

Link: https://github.com/acpica/acpica/pull/121 [#1]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=118601 [#2]
Reported-by: Ye Xiaolong <xiaolong.ye(a)intel.com>
Signed-off-by: Lv Zheng <lv.zheng(a)intel.com>
---
 drivers/acpi/acpica/tbinstal.c | 28 ----------------------------
 drivers/acpi/acpica/tbxfload.c |  2 +-
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index ee74515..9d21296 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -222,34 +222,6 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 	(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 
 	if (reload) {
-		/*
-		 * Validate the incoming table signature.
-		 *
-		 * 1) Originally, we checked the table signature for "SSDT" or "PSDT".
-		 * 2) We added support for OEMx tables, signature "OEM".
-		 * 3) Valid tables were encountered with a null signature, so we just
-		 *    gave up on validating the signature, (05/2008).
-		 * 4) We encountered non-AML tables such as the MADT, which caused
-		 *    interpreter errors and kernel faults. So now, we once again allow
-		 *    only "SSDT", "OEMx", and now, also a null signature. (05/2011).
-		 */
-		if ((new_table_desc.signature.ascii[0] != 0x00) &&
-		    (!ACPI_COMPARE_NAME
-		     (&new_table_desc.signature, ACPI_SIG_SSDT))
-		    && (strncmp(new_table_desc.signature.ascii, "OEM", 3))) {
-			ACPI_BIOS_ERROR((AE_INFO,
-					 "Table has invalid signature [%4.4s] (0x%8.8X), "
-					 "must be SSDT or OEMx",
-					 acpi_ut_valid_nameseg(new_table_desc.
-							       signature.
-							       ascii) ?
-					 new_table_desc.signature.
-					 ascii : "????",
-					 new_table_desc.signature.integer));
-
-			status = AE_BAD_SIGNATURE;
-			goto unlock_and_exit;
-		}
 
 		/* Check if table is already registered */
 
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index b71ce3b..d81f442 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -206,7 +206,7 @@ acpi_status acpi_tb_load_namespace(void)
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
 		table = &acpi_gbl_root_table_list.tables[i];
 
-		if (!acpi_gbl_root_table_list.tables[i].address ||
+		if (!table->address ||
 		    (!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT)
 		     && !ACPI_COMPARE_NAME(table->signature.ascii,
 					   ACPI_SIG_PSDT)
-- 
2.7.4


  parent reply	other threads:[~2017-05-18  9:57 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27  9:34 [PATCH] ACPICA: Detect duplicate SSDT tables Hans de Goede
2017-02-28  5:19 ` Zheng, Lv
2017-02-28  5:19   ` [Devel] " Zheng, Lv
2017-02-28 14:31   ` Hans de Goede
2017-02-28 15:46     ` Moore, Robert
2017-02-28 15:46       ` [Devel] " Moore, Robert
2017-02-28 23:44       ` Hans de Goede
2017-03-01  0:11         ` Moore, Robert
2017-03-01  0:11           ` [Devel] " Moore, Robert
2017-03-01  3:21     ` Zheng, Lv
2017-03-01  3:21       ` [Devel] " Zheng, Lv
2017-03-01  9:19       ` Hans de Goede
2017-03-01 20:38         ` Moore, Robert
2017-03-01 20:38           ` [Devel] " Moore, Robert
2017-03-01 21:56           ` Rafael J. Wysocki
2017-03-02  1:59         ` Zheng, Lv
2017-03-02  1:59           ` [Devel] " Zheng, Lv
2017-03-02 15:24           ` Hans de Goede
2017-03-03  2:50             ` Zheng, Lv
2017-03-03  2:50               ` [Devel] " Zheng, Lv
2017-03-03 13:52               ` Hans de Goede
2017-03-13  6:01                 ` Zheng, Lv
2017-03-13  6:01                   ` [Devel] " Zheng, Lv
2017-05-16  7:13 ` [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred verification support Lv Zheng
2017-05-16  7:13   ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 1/5] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 2/5] ACPICA: Tables: Do not validate signature for dynamic table load Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 4/5] ACPICA: Tables: Combine checksum/duplication verification together Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 5/5] ACPICA: Tables: Add deferred table verification support Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-18 14:01   ` [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred " Hans de Goede
2017-05-19  7:59     ` Zheng, Lv
2017-05-19  7:59       ` [Devel] " Zheng, Lv
2017-05-19  9:49       ` Hans de Goede
2017-05-18  9:57 ` [RFC PATCH v3 " Lv Zheng
2017-05-18  9:57   ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 1/5] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` Lv Zheng [this message]
2017-05-18  9:57     ` [Devel] [RFC PATCH v3 2/5] ACPICA: Tables: Do not validate signature for dynamic table load Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 4/5] ACPICA: Tables: Combine checksum/duplication verification together Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 5/5] ACPICA: Tables: Add deferred table verification support Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng

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=1978962b7d10bd212437816418884400dd498102.1495100623.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=david.e.box@intel.com \
    --cc=devel@acpica.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=zetalog@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.