summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2013-02-21 20:07:52 -0800
committerSimon Horman <horms@verge.net.au>2013-03-05 10:36:22 +0900
commit0bba63fa149543b1dc04bd8ebec0a37777059596 (patch)
tree6cbfd8d39ab76049c9a84d64c870a4474272f8f6
parent1491d196976aa0fd3f7cae23661e3eda6983458c (diff)
downloadkexec-tools-0bba63fa149543b1dc04bd8ebec0a37777059596.tar.gz
kexec, x86: clean boot_params area for entry-32bit path
kexec bzImage path setup data is shared with real-mode path, and setup_header is copied together with setup_code. Later 32bit just use whole area as boot_params for real_mode_data. but those area for boot_params around setup_header is not cleaned that will leave some field in boot_param as non-zero value. So clean whole buffer at first, and only copy setup_header for non real-mode entry path. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/kexec-bzImage.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
index 83a023d9..1069b646 100644
--- a/kexec/arch/i386/kexec-bzImage.c
+++ b/kexec/arch/i386/kexec-bzImage.c
@@ -211,7 +211,19 @@ int do_bzImage_load(struct kexec_info *info,
/* The argument/parameter segment */
setup_size = kern16_size + command_line_len + PURGATORY_CMDLINE_SIZE;
real_mode = xmalloc(setup_size);
- memcpy(real_mode, kernel, kern16_size);
+ memset(real_mode, 0, setup_size);
+ if (!real_mode_entry) {
+ unsigned long setup_header_size = kernel[0x201] + 0x202 - 0x1f1;
+
+ /* only copy setup_header */
+ if (setup_header_size > 0x7f)
+ setup_header_size = 0x7f;
+ memcpy((unsigned char *)real_mode + 0x1f1, kernel + 0x1f1,
+ setup_header_size);
+ } else {
+ /* copy setup code and setup_header */
+ memcpy(real_mode, kernel, kern16_size);
+ }
if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) {
/* If using bzImage for capture kernel, then we will not be