linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: "Zheng, Lv" <lv.zheng@intel.com>
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"Brown, Len" <len.brown@intel.com>,
	"Moore, Robert" <robert.moore@intel.com>,
	"Box, David E" <david.e.box@intel.com>,
	Lv Zheng <zetalog@gmail.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"devel@acpica.org" <devel@acpica.org>,
	Hans de Goede <hdegoede@redhat.com>,
	"Du, Julie" <julie.du@intel.com>
Subject: Re: [RFC PATCH 5/7] ACPICA: Tables: Enable acpi_ut_is_aml_table() for all ACPICA modules
Date: Wed, 22 Mar 2017 15:10:30 +0800	[thread overview]
Message-ID: <20170322071030.GL26669@yexl-desktop> (raw)
In-Reply-To: <1AE640813FDE7649BE1B193DEA596E886CE4E589@SHSMSX101.ccr.corp.intel.com>

On 03/22, Zheng, Lv wrote:
>Hi, Hans
>
>Just FYI.
>This commit is wrong.
>It shouldn't change static table load signature check.
>Should be replaced by this fix:
>https://github.com/acpica/acpica/pull/121/commits/3d9eeb046c
>Thanks Xiaolong for his test and report.

I'm glad it helps. :)

Thanks,
Xiaolong
>
>Thanks and best regards
>Lv
>
>> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Lv Zheng
>> Subject: [RFC PATCH 5/7] ACPICA: Tables: Enable acpi_ut_is_aml_table() for all ACPICA modules
>> 
>> This patch enables acpi_ut_is_aml_table() for all ACPICA modules so that it can
>> be used by Linux kernel. Lv Zheng.
>> 
>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
>> Cc: Hans de Goede <hdegoede@redhat.com>
>> ---
>>  drivers/acpi/acpica/acutils.h  |  4 +---
>>  drivers/acpi/acpica/tbdata.c   | 17 +++--------------
>>  drivers/acpi/acpica/tbxfload.c | 10 +++-------
>>  drivers/acpi/acpica/utmisc.c   | 27 +++++++++++++++++----------
>>  4 files changed, 24 insertions(+), 34 deletions(-)
>> 
>> diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
>> index 6f28cfa..c0b697f 100644
>> --- a/drivers/acpi/acpica/acutils.h
>> +++ b/drivers/acpi/acpica/acutils.h
>> @@ -545,9 +545,7 @@ const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status
>> 
>>  u8 acpi_ut_is_pci_root_bridge(char *id);
>> 
>> -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
>> -u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
>> -#endif
>> +u8 acpi_ut_is_aml_table(char *signature);
>> 
>>  acpi_status
>>  acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
>> diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
>> index 1a4371b..1e1222d 100644
>> --- a/drivers/acpi/acpica/tbdata.c
>> +++ b/drivers/acpi/acpica/tbdata.c
>> @@ -859,20 +859,9 @@ acpi_tb_validate_table_for_load(u32 *table_index,
>>  		goto unlock_and_exit;
>>  	}
>> 
>> -	/*
>> -	 * 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 ((table_desc->signature.ascii[0] != 0x00) &&
>> -	    (!ACPI_COMPARE_NAME(&table_desc->signature, ACPI_SIG_SSDT)) &&
>> -	    (strncmp(table_desc->signature.ascii, "OEM", 3))) {
>> +	/* Validate the incoming table signature */
>> +
>> +	if (!acpi_ut_is_aml_table(table_desc->signature.ascii)) {
>>  		ACPI_BIOS_ERROR((AE_INFO,
>>  				 "Table has invalid signature [%4.4s] (0x%8.8X), "
>>  				 "must be SSDT or OEMx",
>> diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
>> index b71ce3b..9753176 100644
>> --- a/drivers/acpi/acpica/tbxfload.c
>> +++ b/drivers/acpi/acpica/tbxfload.c
>> @@ -206,13 +206,9 @@ 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 ||
>> -		    (!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT)
>> -		     && !ACPI_COMPARE_NAME(table->signature.ascii,
>> -					   ACPI_SIG_PSDT)
>> -		     && !ACPI_COMPARE_NAME(table->signature.ascii,
>> -					   ACPI_SIG_OSDT))
>> -		    || ACPI_FAILURE(acpi_tb_validate_table(table))) {
>> +		if (!table->address || i == acpi_gbl_dsdt_index ||
>> +		    !acpi_ut_is_aml_table(table->signature.ascii) ||
>> +		    ACPI_FAILURE(acpi_tb_validate_table(table))) {
>>  			continue;
>>  		}
>> 
>> diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
>> index 443ffad..e5074d8 100644
>> --- a/drivers/acpi/acpica/utmisc.c
>> +++ b/drivers/acpi/acpica/utmisc.c
>> @@ -75,7 +75,6 @@ u8 acpi_ut_is_pci_root_bridge(char *id)
>>  	return (FALSE);
>>  }
>> 
>> -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
>>  /*******************************************************************************
>>   *
>>   * FUNCTION:    acpi_ut_is_aml_table
>> @@ -90,21 +89,29 @@ u8 acpi_ut_is_pci_root_bridge(char *id)
>>   *
>>   ******************************************************************************/
>> 
>> -u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
>> +u8 acpi_ut_is_aml_table(char *signature)
>>  {
>> -
>> -	/* These are the only tables that contain executable AML */
>> -
>> -	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
>> -	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
>> -	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) ||
>> -	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) {
>> +	/*
>> +	 * These are the only tables that contain executable AML
>> +	 * 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 (signature[0] == 0x00 ||
>> +	    ACPI_COMPARE_NAME(signature, ACPI_SIG_DSDT) ||
>> +	    ACPI_COMPARE_NAME(signature, ACPI_SIG_PSDT) ||
>> +	    ACPI_COMPARE_NAME(signature, ACPI_SIG_SSDT) ||
>> +	    ACPI_COMPARE_NAME(signature, ACPI_SIG_OSDT) ||
>> +	    strncmp(signature, "OEM", 3) == 0) {
>>  		return (TRUE);
>>  	}
>> 
>>  	return (FALSE);
>>  }
>> -#endif
>> 
>>  /*******************************************************************************
>>   *
>> --
>> 2.7.4
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-03-22  7:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  6:36 [RFC PATCH 0/7] ACPICA: Tables: Cleanup table sanity checks Lv Zheng
2017-03-15  6:36 ` [RFC PATCH 1/7] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-03-15  6:37 ` [RFC PATCH 2/7] ACPICA: Tables: Add sanity check for load_table opcode Lv Zheng
2017-03-15  6:37 ` [RFC PATCH 3/7] ACPICA: Tables: Add sanity check for table install Lv Zheng
2017-03-15  6:37 ` [RFC PATCH 4/7] ACPICA: Tables: Fix an unwanted exception for table reloading Lv Zheng
2017-03-15  6:37 ` [RFC PATCH 5/7] ACPICA: Tables: Enable acpi_ut_is_aml_table() for all ACPICA modules Lv Zheng
2017-03-22  7:00   ` Zheng, Lv
2017-03-22  7:10     ` Ye Xiaolong [this message]
2017-03-15  6:37 ` [RFC PATCH 6/7] ACPICA: Tables: Add sanity check for static table load Lv Zheng
2017-03-15  6:37 ` [RFC PATCH 7/7] ACPICA: Tables: Change table comparison using table header for static load tables Lv Zheng
2017-03-15 13:33 ` [RFC PATCH 0/7] ACPICA: Tables: Cleanup table sanity checks Hans de Goede
2017-03-16  6:29   ` Zheng, Lv
2017-03-16  6:50     ` Zheng, Lv

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=20170322071030.GL26669@yexl-desktop \
    --to=xiaolong.ye@intel.com \
    --cc=david.e.box@intel.com \
    --cc=devel@acpica.org \
    --cc=hdegoede@redhat.com \
    --cc=julie.du@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).