linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders
@ 2018-12-03 10:38 Juergen Gross
  2018-12-03 15:54 ` [tip:x86/urgent] x86/boot: Clear RSDP " tip-bot for Juergen Gross
  2018-12-03 23:07 ` [PATCH] x86/boot: clear rsdp " hpa
  0 siblings, 2 replies; 6+ messages in thread
From: Juergen Gross @ 2018-12-03 10:38 UTC (permalink / raw)
  To: linux-kernel, x86; +Cc: sstabellini, hpa, tglx, mingo, bp, Juergen Gross

In case a broken boot loader doesn't clear its struct boot_params clear
rsdp_addr in sanitize_boot_params().

This fixes commit e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP
address from boot params if available") e.g. for the case of a boot via
systemd-boot.

Fixes: e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP address from boot params if available")
Reported-by: Gunnar Krueger <taijian@posteo.de>
Tested-by: Gunnar Krueger <taijian@posteo.de>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/bootparam_utils.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
index a07ffd23e4dd..f6f6ef436599 100644
--- a/arch/x86/include/asm/bootparam_utils.h
+++ b/arch/x86/include/asm/bootparam_utils.h
@@ -36,6 +36,7 @@ static void sanitize_boot_params(struct boot_params *boot_params)
 	 */
 	if (boot_params->sentinel) {
 		/* fields in boot_params are left uninitialized, clear them */
+		boot_params->acpi_rsdp_addr = 0;
 		memset(&boot_params->ext_ramdisk_image, 0,
 		       (char *)&boot_params->efi_info -
 			(char *)&boot_params->ext_ramdisk_image);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [tip:x86/urgent] x86/boot: Clear RSDP address in boot_params for broken loaders
  2018-12-03 10:38 [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders Juergen Gross
@ 2018-12-03 15:54 ` tip-bot for Juergen Gross
  2018-12-03 23:07 ` [PATCH] x86/boot: clear rsdp " hpa
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Juergen Gross @ 2018-12-03 15:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, hpa, peterz, tglx, mingo, linux-kernel, taijian, jgross

Commit-ID:  182ddd16194cd082f25fa1b063dae3c7c5cce384
Gitweb:     https://git.kernel.org/tip/182ddd16194cd082f25fa1b063dae3c7c5cce384
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon, 3 Dec 2018 11:38:11 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 3 Dec 2018 11:56:37 +0100

x86/boot: Clear RSDP address in boot_params for broken loaders

Gunnar Krueger reported a systemd-boot failure and bisected it down to:

  e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP address from boot params if available")

In case a broken boot loader doesn't clear its 'struct boot_params', clear
rsdp_addr in sanitize_boot_params().

Reported-by: Gunnar Krueger <taijian@posteo.de>
Tested-by: Gunnar Krueger <taijian@posteo.de>
Signed-off-by: Juergen Gross <jgross@suse.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@alien8.de
Cc: sstabellini@kernel.org
Fixes: e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP address from boot params if available")
Link: http://lkml.kernel.org/r/20181203103811.17056-1-jgross@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/bootparam_utils.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
index a07ffd23e4dd..f6f6ef436599 100644
--- a/arch/x86/include/asm/bootparam_utils.h
+++ b/arch/x86/include/asm/bootparam_utils.h
@@ -36,6 +36,7 @@ static void sanitize_boot_params(struct boot_params *boot_params)
 	 */
 	if (boot_params->sentinel) {
 		/* fields in boot_params are left uninitialized, clear them */
+		boot_params->acpi_rsdp_addr = 0;
 		memset(&boot_params->ext_ramdisk_image, 0,
 		       (char *)&boot_params->efi_info -
 			(char *)&boot_params->ext_ramdisk_image);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders
  2018-12-03 10:38 [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders Juergen Gross
  2018-12-03 15:54 ` [tip:x86/urgent] x86/boot: Clear RSDP " tip-bot for Juergen Gross
@ 2018-12-03 23:07 ` hpa
  2018-12-04  5:32   ` Juergen Gross
  1 sibling, 1 reply; 6+ messages in thread
From: hpa @ 2018-12-03 23:07 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, x86; +Cc: sstabellini, tglx, mingo, bp

On December 3, 2018 2:38:11 AM PST, Juergen Gross <jgross@suse.com> wrote:
>In case a broken boot loader doesn't clear its struct boot_params clear
>rsdp_addr in sanitize_boot_params().
>
>This fixes commit e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP
>address from boot params if available") e.g. for the case of a boot via
>systemd-boot.
>
>Fixes: e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP address from boot
>params if available")
>Reported-by: Gunnar Krueger <taijian@posteo.de>
>Tested-by: Gunnar Krueger <taijian@posteo.de>
>Signed-off-by: Juergen Gross <jgross@suse.com>
>---
> arch/x86/include/asm/bootparam_utils.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/arch/x86/include/asm/bootparam_utils.h
>b/arch/x86/include/asm/bootparam_utils.h
>index a07ffd23e4dd..f6f6ef436599 100644
>--- a/arch/x86/include/asm/bootparam_utils.h
>+++ b/arch/x86/include/asm/bootparam_utils.h
>@@ -36,6 +36,7 @@ static void sanitize_boot_params(struct boot_params
>*boot_params)
> 	 */
> 	if (boot_params->sentinel) {
> 		/* fields in boot_params are left uninitialized, clear them */
>+		boot_params->acpi_rsdp_addr = 0;
> 		memset(&boot_params->ext_ramdisk_image, 0,
> 		       (char *)&boot_params->efi_info -
> 			(char *)&boot_params->ext_ramdisk_image);

Isn't this already covered by the memset()? If not, we should extend the memset() to maximal coverage.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders
  2018-12-03 23:07 ` [PATCH] x86/boot: clear rsdp " hpa
@ 2018-12-04  5:32   ` Juergen Gross
  2018-12-04  5:49     ` H. Peter Anvin
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross @ 2018-12-04  5:32 UTC (permalink / raw)
  To: hpa, linux-kernel, x86; +Cc: sstabellini, tglx, mingo, bp

On 04/12/2018 00:07, hpa@zytor.com wrote:
> On December 3, 2018 2:38:11 AM PST, Juergen Gross <jgross@suse.com> wrote:
>> In case a broken boot loader doesn't clear its struct boot_params clear
>> rsdp_addr in sanitize_boot_params().
>>
>> This fixes commit e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP
>> address from boot params if available") e.g. for the case of a boot via
>> systemd-boot.
>>
>> Fixes: e6e094e053af75 ("x86/acpi, x86/boot: Take RSDP address from boot
>> params if available")
>> Reported-by: Gunnar Krueger <taijian@posteo.de>
>> Tested-by: Gunnar Krueger <taijian@posteo.de>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>> arch/x86/include/asm/bootparam_utils.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/x86/include/asm/bootparam_utils.h
>> b/arch/x86/include/asm/bootparam_utils.h
>> index a07ffd23e4dd..f6f6ef436599 100644
>> --- a/arch/x86/include/asm/bootparam_utils.h
>> +++ b/arch/x86/include/asm/bootparam_utils.h
>> @@ -36,6 +36,7 @@ static void sanitize_boot_params(struct boot_params
>> *boot_params)
>> 	 */
>> 	if (boot_params->sentinel) {
>> 		/* fields in boot_params are left uninitialized, clear them */
>> +		boot_params->acpi_rsdp_addr = 0;
>> 		memset(&boot_params->ext_ramdisk_image, 0,
>> 		       (char *)&boot_params->efi_info -
>> 			(char *)&boot_params->ext_ramdisk_image);
> 
> Isn't this already covered by the memset()? If not, we should extend the memset() to maximal coverage.

I'd like to send a followup patch doing that. And I'd like to not only
test sentinel for being non-zero, but all padding fields as well. This
should be 4.21 material, though.


Juergen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders
  2018-12-04  5:32   ` Juergen Gross
@ 2018-12-04  5:49     ` H. Peter Anvin
  2018-12-04  6:03       ` Juergen Gross
  0 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2018-12-04  5:49 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, x86; +Cc: sstabellini, tglx, mingo, bp

On 12/3/18 9:32 PM, Juergen Gross wrote:
> 
> I'd like to send a followup patch doing that. And I'd like to not only
> test sentinel for being non-zero, but all padding fields as well. This
> should be 4.21 material, though.
> 

No, you can't do that.  That breaks backwards compatibility.

	-hpa


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders
  2018-12-04  5:49     ` H. Peter Anvin
@ 2018-12-04  6:03       ` Juergen Gross
  0 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2018-12-04  6:03 UTC (permalink / raw)
  To: H. Peter Anvin, linux-kernel, x86; +Cc: sstabellini, tglx, mingo, bp

On 04/12/2018 06:49, H. Peter Anvin wrote:
> On 12/3/18 9:32 PM, Juergen Gross wrote:
>>
>> I'd like to send a followup patch doing that. And I'd like to not only
>> test sentinel for being non-zero, but all padding fields as well. This
>> should be 4.21 material, though.
>>
> 
> No, you can't do that.  That breaks backwards compatibility.

So you are speaking about paddings which are at places where there used
to be some information? Shouldn't those be named "_res*"?
Recycling such paddings with some useful information seems to be rather
dangerous then.

I'd like to have at least some idea which boot loader is not passing a
clean struct boot_params. So I think we should at least have some debug
or info messages telling us which paddings are not zero initially to be
able to either fix the boot loader or switch from _pad* to _res* naming.


Juergen

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-04  6:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 10:38 [PATCH] x86/boot: clear rsdp address in boot_params for broken loaders Juergen Gross
2018-12-03 15:54 ` [tip:x86/urgent] x86/boot: Clear RSDP " tip-bot for Juergen Gross
2018-12-03 23:07 ` [PATCH] x86/boot: clear rsdp " hpa
2018-12-04  5:32   ` Juergen Gross
2018-12-04  5:49     ` H. Peter Anvin
2018-12-04  6:03       ` Juergen Gross

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).