[PATCH v4] x86/boot: Use efi_setup_data for searching RSDP on kexec-ed kernel

Junichi Nomura j-nomura at ce.jp.nec.com
Thu Apr 11 02:13:03 PDT 2019


On 4/11/19 5:37 PM, Borislav Petkov wrote:
> On Thu, Apr 11, 2019 at 08:16:45AM +0000, Junichi Nomura wrote:
>> kexec_get_rsdp_addr() might fail on kexec-booted kernel, e.g. if the
>> setup_data was invalid. In such a case, falling back to efi_get_rsdp_addr()
>> will hit the problem of accessing invalid table pointer again.
> 
> Then you need to do this:
> 
> 	if (kexeced kernel) {
> 		addr = kexec_get_rsdp_addr();
> 		if (!addr) {
> 			/* cannot get address */
> 			return -1;
> 		}
> 
> 		return addr;
> 	}
> 
> and the calling function get_rsdp_addr() must check the return value and
> if it is not 0, return immediately.

Do you mean making get_rsdp_addr() like this?

acpi_physical_address get_rsdp_addr(void)
{
        acpi_physical_address pa;
+       struct efi_setup_data *esd;

        pa = get_acpi_rsdp();

        if (!pa)
                pa = boot_params->acpi_rsdp_addr;

+       esd = (struct efi_setup_data *) efi_get_kexec_setup_data_addr();
+       if (esd)
+		return kexec_get_rsdp_addr(esd);

        if (!pa)
                pa = efi_get_rsdp_addr();



-- 
Jun'ichi Nomura, NEC Corporation / NEC Solution Innovators, Ltd.


More information about the kexec mailing list