Fix command line length bug w/ upstream patch

This commit is contained in:
Neil Horman 2008-04-16 15:22:03 +00:00
parent 163b36d3bb
commit ff899b91aa
2 changed files with 85 additions and 1 deletions

View File

@ -0,0 +1,79 @@
diff -up kexec-tools-testing-20070330/include/x86/x86-linux.h.orig kexec-tools-testing-20070330/include/x86/x86-linux.h
--- kexec-tools-testing-20070330/include/x86/x86-linux.h.orig 2007-03-30 00:34:36.000000000 -0400
+++ kexec-tools-testing-20070330/include/x86/x86-linux.h 2008-03-13 11:21:45.000000000 -0400
@@ -144,18 +144,22 @@ struct x86_linux_param_header {
/* 2.04+ */
uint32_t kernel_alignment; /* 0x230 */
uint8_t relocatable_kernel; /* 0x234 */
- uint8_t reserved15[0x2d0 - 0x235]; /* 0x230 */
+ uint8_t reserved15[3]; /* 0x235 */
+ uint32_t cmdline_size; /* 0x238 */
+ uint32_t hardware_subarch; /* 0x23C */
+ uint64_t hardware_subarch_data; /* 0x240 */
+ uint8_t reserved16[0x2d0 - 0x248]; /* 0x248 */
#endif
struct e820entry e820_map[E820MAX]; /* 0x2d0 */
/* 0x550 */
-#define COMMAND_LINE_SIZE 256
+#define COMMAND_LINE_SIZE 2048
};
struct x86_linux_faked_param_header {
struct x86_linux_param_header hdr; /* 0x00 */
- uint8_t reserved16[688]; /* 0x550 */
- uint8_t command_line[COMMAND_LINE_SIZE]; /* 0x800 */
- uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
+ uint8_t reserved17[0xab0]; /* 0x550 */
+ uint8_t command_line[COMMAND_LINE_SIZE]; /* 0x1000 */
+ uint8_t reserved18[0x200]; /* 0x1800 - 0x2000 */
};
struct x86_linux_header {
@@ -206,7 +210,11 @@ struct x86_linux_header {
#else
uint32_t kernel_alignment; /* 0x230 */
uint8_t relocatable_kernel; /* 0x234 */
- uint8_t tail[32*1024 - 0x235]; /* 0x230 */
+ uint8_t reserved6[3]; /* 0x235 */
+ uint32_t cmdline_size; /* 0x238 */
+ uint32_t hardware_subarch; /* 0x23C */
+ uint64_t hardware_subarch_data; /* 0x240 */
+ uint8_t tail[32*1024 - 0x248]; /* 0x248 */
#endif
} PACKED;
diff -up kexec-tools-testing-20070330/kexec/arch/i386/kexec-bzImage.c.orig kexec-tools-testing-20070330/kexec/arch/i386/kexec-bzImage.c
--- kexec-tools-testing-20070330/kexec/arch/i386/kexec-bzImage.c.orig 2008-03-13 11:19:03.000000000 -0400
+++ kexec-tools-testing-20070330/kexec/arch/i386/kexec-bzImage.c 2008-03-13 11:21:45.000000000 -0400
@@ -134,6 +134,17 @@ int do_bzImage_load(struct kexec_info *i
return -1;
}
+ if (setup_header.protocol_version >= 0x0206) {
+ if (command_line_len > setup_header.cmdline_size) {
+ printf("Kernel command line too long for kernel!\n");
+ return -1;
+ }
+ } else {
+ if (command_line_len > 255) {
+ printf("WARNING: This kernel may only support 255 byte command lines\n");
+ }
+ }
+
if (setup_header.protocol_version >= 0x0205) {
relocatable_kernel = setup_header.relocatable_kernel;
dfprintf(stdout, "bzImage is relocatable\n");
diff -up kexec-tools-testing-20070330/kexec/arch/i386/x86-linux-setup.c.orig kexec-tools-testing-20070330/kexec/arch/i386/x86-linux-setup.c
--- kexec-tools-testing-20070330/kexec/arch/i386/x86-linux-setup.c.orig 2007-03-30 00:34:36.000000000 -0400
+++ kexec-tools-testing-20070330/kexec/arch/i386/x86-linux-setup.c 2008-03-13 11:21:45.000000000 -0400
@@ -38,8 +38,9 @@ void init_linux_parameters(struct x86_li
/* Boot block magic */
memcpy(real_mode->header_magic, "HdrS", 4);
- real_mode->protocol_version = 0x0203;
+ real_mode->protocol_version = 0x0206;
real_mode->initrd_addr_max = DEFAULT_INITRD_ADDR_MAX;
+ real_mode->cmdline_size = COMMAND_LINE_SIZE;
}
void setup_linux_bootloader_parameters(

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 1.102pre
Release: 8%{?dist}
Release: 9%{?dist}
License: GPL
Group: Applications/System
Summary: The kexec/kdump userspace component.
@ -68,6 +68,7 @@ Patch603: kexec-tools-1.102pre-makedumpfile-xen-syms.patch
Patch604: kexec-tools-1.102pre-disable-kexec-test.patch
Patch605: kexec-tools-1.102pre-vmcoreinfo.patch
Patch606: kexec-tools-1.102pre-makedumpfile-makefile.patch
Patch607: kexec-tools-1.102pre-cmdline-length.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -99,6 +100,7 @@ tar -z -x -v -f %{SOURCE9}
%patch604 -p1
%patch605 -p1
%patch606 -p1
%patch607 -p1
tar -z -x -v -f %{SOURCE13}
@ -227,6 +229,9 @@ done
%doc kexec-kdump-howto.txt
%changelog
* Wed Apr 16 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-9
- Fix cmdline length issue
* Tue Mar 25 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-8
- Fixing ARCH definition for bz 438661