aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/head64.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2013-01-29 04:05:24 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2013-01-29 04:22:17 -0500
commit5dcd14ecd41ea2b3ae3295a9b30d98769d52165f (patch)
tree0bdf705c1fd6d6e5832f392e9b445a1aa5d265e3 /arch/x86/kernel/head64.c
parent09c205afde70c15f20ca76ba0a57409dad175fd0 (diff)
x86, boot: Sanitize boot_params if not zeroed on creation
Use the new sentinel field to detect bootloaders which fail to follow protocol and don't initialize fields in struct boot_params that they do not explicitly initialize to zero. Based on an original patch and research by Yinghai Lu. Changed by hpa to be invoked both in the decompression path and in the kernel proper; the latter for the case where a bootloader takes over decompression. Originally-by: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/1359058816-7615-26-git-send-email-yinghai@kernel.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/head64.c')
-rw-r--r--arch/x86/kernel/head64.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 037df57a99ac..849fc9e63c2f 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -25,6 +25,7 @@
25#include <asm/kdebug.h> 25#include <asm/kdebug.h>
26#include <asm/e820.h> 26#include <asm/e820.h>
27#include <asm/bios_ebda.h> 27#include <asm/bios_ebda.h>
28#include <asm/bootparam_utils.h>
28 29
29static void __init zap_identity_mappings(void) 30static void __init zap_identity_mappings(void)
30{ 31{
@@ -46,6 +47,7 @@ static void __init copy_bootdata(char *real_mode_data)
46 char * command_line; 47 char * command_line;
47 48
48 memcpy(&boot_params, real_mode_data, sizeof boot_params); 49 memcpy(&boot_params, real_mode_data, sizeof boot_params);
50 sanitize_boot_params(&boot_params);
49 if (boot_params.hdr.cmd_line_ptr) { 51 if (boot_params.hdr.cmd_line_ptr) {
50 command_line = __va(boot_params.hdr.cmd_line_ptr); 52 command_line = __va(boot_params.hdr.cmd_line_ptr);
51 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 53 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);