diff options
author | Josh Boyer <jwboyer@gmail.com> | 2013-03-06 23:23:30 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2013-03-06 23:23:30 -0500 |
commit | 2e604c0f19dcdd433b3863ffc3da9bc0787ca765 (patch) | |
tree | cc1280c896e0db70cf53dda68f5b8c29651cbad6 /arch/x86 | |
parent | 98e7a989979b185f49e86ddaed2ad6890299d9f0 (diff) |
x86: Don't clear efi_info even if the sentinel hits
When boot_params->sentinel is set, all we really know is that some
undefined set of fields in struct boot_params contain garbage. In the
particular case of efi_info, however, there is a private magic for
that substructure, so it is generally safe to leave it even if the
bootloader is broken.
kexec (for which we did the initial analysis) did not initialize this
field, but of course all the EFI bootloaders do, and most EFI
bootloaders are broken in this respect (and should be fixed.)
Reported-by: Robin Holt <holt@sgi.com>
Link: http://lkml.kernel.org/r/CA%2B5PVA51-FT14p4CRYKbicykugVb=PiaEycdQ57CK2km_OQuRQ@mail.gmail.com
Tested-by: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/bootparam_utils.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h index 5b5e9cb774b5..ff808ef4fdb4 100644 --- a/arch/x86/include/asm/bootparam_utils.h +++ b/arch/x86/include/asm/bootparam_utils.h | |||
@@ -14,13 +14,15 @@ | |||
14 | * analysis of kexec-tools; if other broken bootloaders initialize a | 14 | * analysis of kexec-tools; if other broken bootloaders initialize a |
15 | * different set of fields we will need to figure out how to disambiguate. | 15 | * different set of fields we will need to figure out how to disambiguate. |
16 | * | 16 | * |
17 | * Note: efi_info is commonly left uninitialized, but that field has a | ||
18 | * private magic, so it is better to leave it unchanged. | ||
17 | */ | 19 | */ |
18 | static void sanitize_boot_params(struct boot_params *boot_params) | 20 | static void sanitize_boot_params(struct boot_params *boot_params) |
19 | { | 21 | { |
20 | if (boot_params->sentinel) { | 22 | if (boot_params->sentinel) { |
21 | /*fields in boot_params are not valid, clear them */ | 23 | /*fields in boot_params are not valid, clear them */ |
22 | memset(&boot_params->olpc_ofw_header, 0, | 24 | memset(&boot_params->olpc_ofw_header, 0, |
23 | (char *)&boot_params->alt_mem_k - | 25 | (char *)&boot_params->efi_info - |
24 | (char *)&boot_params->olpc_ofw_header); | 26 | (char *)&boot_params->olpc_ofw_header); |
25 | memset(&boot_params->kbd_status, 0, | 27 | memset(&boot_params->kbd_status, 0, |
26 | (char *)&boot_params->hdr - | 28 | (char *)&boot_params->hdr - |