Linux ACPI
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Len Brown <lenb@kernel.org>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] x86/acpi: check rsdp address received via bootparams to be valid
Date: Wed, 17 Jan 2018 13:20:01 +0100	[thread overview]
Message-ID: <23728a6c-b820-4d37-d522-1a70b4304d28@suse.com> (raw)
In-Reply-To: <CAJZ5v0j2GMvpYjURfx9N=RFYsVAmdWDwVNMG3-rxDf72ckmn_A@mail.gmail.com>

On 17/01/18 12:49, Rafael J. Wysocki wrote:
> On Tue, Jan 16, 2018 at 2:57 PM, Juergen Gross <jgross@suse.com> wrote:
>> There seem to exist several grub2 versions trashing
>> boot_params.hdr.acpi_rsdp_addr.
>>
>> So don't just believe this address to be valid, but verify it pointing
>> to a valid RSDP table.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>> To be applied on top of my RSDP series currently in tip.git x86/boot
>> Mike Galbraith has tested this patch to repair his broken boot
>> ---
>>  drivers/acpi/acpica/tbxfroot.c | 36 ++++++++++++++++++++++++++++++++++++
>>  drivers/acpi/osl.c             |  2 +-
>>  include/acpi/acpixf.h          |  5 +++++
>>  3 files changed, 42 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
>> index f9f9a7da2cad..9edc71780a38 100644
>> --- a/drivers/acpi/acpica/tbxfroot.c
>> +++ b/drivers/acpi/acpica/tbxfroot.c
>> @@ -249,6 +249,42 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_find_root_pointer)
>>
>>  /*******************************************************************************
>>   *
>> + * FUNCTION:    acpi_verify_root_pointer
> 
> Why do you want this to go into ACPICA?

It seemed to fit in here.

>> + *
>> + *
>> + * PARAMETERS:  rsdp_address        - Pointer to suspected RSDP
>> + *
>> + * RETURN:      AE_OK if rsdp_address really points to a RSDP, AE_NOT_FOUND
>> + *              else
>> + *
>> + * DESCRIPTION: Verify a physical address being a valid RSDP
>> + *
>> + ******************************************************************************/
>> +
>> +acpi_status ACPI_INIT_FUNCTION
>> +acpi_verify_root_pointer(acpi_physical_address rsdp_address)
>> +{
>> +       acpi_status status;
>> +       struct acpi_table_rsdp *rsdp;
>> +
>> +       ACPI_FUNCTION_TRACE(acpi_verify_root_pointer);
>> +
>> +       rsdp = acpi_os_map_memory(rsdp_address, sizeof(*rsdp));
>> +
>> +       if (!rsdp)
>> +               return_ACPI_STATUS(AE_NO_MEMORY);
>> +
>> +       status = acpi_tb_validate_rsdp(rsdp);
>> +
>> +       acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
>> +
>> +       return_ACPI_STATUS(status);
>> +}
>> +
>> +ACPI_EXPORT_SYMBOL_INIT(acpi_verify_root_pointer)
>> +
>> +/*******************************************************************************
>> + *
>>   * FUNCTION:    acpi_tb_scan_memory_for_rsdp
>>   *
>>   * PARAMETERS:  start_address       - Starting pointer for search
>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
>> index 2b77db914752..facff5c11f32 100644
>> --- a/drivers/acpi/osl.c
>> +++ b/drivers/acpi/osl.c
>> @@ -201,7 +201,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
>>                 return acpi_rsdp;
>>  #endif
>>         pa = acpi_arch_get_root_pointer();
>> -       if (pa)
>> +       if (pa && acpi_verify_root_pointer(pa) == AE_OK)
> 
> All things needed could just be done locally in this file.

Okay, if you prefer it this way I can move acpi_verify_root_pointer() to
osl.c.


Juergen

      reply	other threads:[~2018-01-17 12:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 13:57 [PATCH] x86/acpi: check rsdp address received via bootparams to be valid Juergen Gross
2018-01-16 15:46 ` Ingo Molnar
2018-01-16 15:56   ` Juergen Gross
2018-01-16 16:35     ` Ingo Molnar
2018-01-17 12:28       ` Juergen Gross
2018-01-17 15:34         ` Ingo Molnar
2018-01-17 18:12           ` Juergen Gross
2018-02-13 16:32             ` Ingo Molnar
2018-02-13 16:48               ` Juergen Gross
2018-01-17 11:49 ` Rafael J. Wysocki
2018-01-17 12:20   ` Juergen Gross [this message]

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=23728a6c-b820-4d37-d522-1a70b4304d28@suse.com \
    --to=jgross@suse.com \
    --cc=hpa@zytor.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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