public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Simon Horman <horms@verge.net.au>,
	"H. Peter Anvin" <hpa@zytor.com>, Vivek Goyal <vgoyal@redhat.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Cc: Yinghai Lu <yinghai@kernel.org>, kexec@lists.infradead.org
Subject: [PATCH v8 3/7] kexec, x86: clean boot_params area for entry-32bit path
Date: Wed, 30 Jan 2013 13:25:16 -0800	[thread overview]
Message-ID: <1359581120-24397-4-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1359581120-24397-1-git-send-email-yinghai@kernel.org>

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 around setup_header area for non real-mode entry path.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 kexec/arch/i386/kexec-bzImage.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
index 83a023d..1dfa3d7 100644
--- a/kexec/arch/i386/kexec-bzImage.c
+++ b/kexec/arch/i386/kexec-bzImage.c
@@ -98,6 +98,19 @@ void bzImage_usage(void)
        
 }
 
+static void clean_boot_params(unsigned char *real_mode, unsigned long size)
+{
+	unsigned long end;
+
+	/* clear value before header */
+	memset(real_mode, 0, 0x1f1);
+	/* clear value after setup_header  */
+	end = *(real_mode + 0x201);
+	end += 0x202;
+	if (end < size)
+		memset(real_mode + end, 0, size - end);
+}
+
 int do_bzImage_load(struct kexec_info *info,
 	const char *kernel, off_t kernel_len,
 	const char *command_line, off_t command_line_len,
@@ -212,6 +225,8 @@ int do_bzImage_load(struct kexec_info *info,
 	setup_size = kern16_size + command_line_len + PURGATORY_CMDLINE_SIZE;
 	real_mode = xmalloc(setup_size);
 	memcpy(real_mode, kernel, kern16_size);
+	if (!real_mode_entry)
+		clean_boot_params((unsigned char *)real_mode, kern16_size);
 
 	if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) {
 		/* If using bzImage for capture kernel, then we will not be
-- 
1.7.10.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2013-01-30 21:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 21:25 [PATCH v8 0/7] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 1/7] kexec, x86: set booloader id in setup_header Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 2/7] kexec, x86: add boot header member for version 2.12 Yinghai Lu
2013-01-30 21:25 ` Yinghai Lu [this message]
2013-01-30 21:34   ` [PATCH v8 3/7] kexec, x86: clean boot_params area for entry-32bit path H. Peter Anvin
2013-01-30 22:09     ` Yinghai Lu
2013-01-30 22:11       ` H. Peter Anvin
2013-01-30 21:25 ` [PATCH v8 4/7] kexec, x86: Fix bzImage real-mode booting Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 5/7] kexec, x86: put ramdisk/cmd_line above 4G for 64bit bzImage Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 6/7] kexec, x86_64: Load bzImage64 above 4G Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 7/7] kexec, x86: handle Crash low kernel range Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359581120-24397-4-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox