summaryrefslogtreecommitdiff
path: root/kexec
AgeCommit message (Collapse)Author
2013-09-19cris/mips: Remove unused setup_simple_* declarationsGeert Uytterhoeven
Presumably these had been copied from ppc. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-07-26kexec -p fails on kernel versions of form x.yKhalid Aziz
"kexec -p" fails to load kernels with version of the form x.y instead of x.y.z with an error message similar to "Unsupported utsname.release: 3.10-1-amd64". Code in kernel_version() also checks the wrong variable name for error return value from strtoul() for "minor" and "patch", and hence possibly missing a real error. These changes fix both of these problems. Signed-off-by: Khalid Aziz <khalid@gonehiking.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-21arm: Fix out of tree build errorGeoff Levand
Prefix local include paths with $(srcdir)/. Fixes build errors like these when building for ARM out of the source tree: cc1: fatal error: kexec/arch/arm/crashdump-arm.h: No such file or directory Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10kexec-tools: sh: Remove saved_max_memZhang Yanfei
saved_max_mem is used to calculate the amount of memory that the previous kernel used. It seems in sh, we just calculate this variable, but we never use it. So remove it. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10kexec-tools: ppc64: Remove saved_max_memZhang Yanfei
saved_max_mem is used to calculate the amount of memory that the previous kernel used. And passed to the dump-capture kernel by kernel commandline parameter "savemaxmem=". But in the dump-capture kernel, we never use this parameter now, so remove saved_max_mem and don't add "savemaxmem=" to new kernel commandline. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10kexec-tools: ppc: Remove saved_max_memZhang Yanfei
saved_max_mem is used to calculate the amount of memory that the previous kernel used. And passed to the dump-capture kernel by kernel commandline parameter "savemaxmem=". But in the dump-capture kernel, we never use this parameter now, so remove saved_max_mem and don't add "savemaxmem=" to new kernel commandline. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10kexec-tools: mips: Remove saved_max_memZhang Yanfei
saved_max_mem is used to calculate the amount of memory that the previous kernel used. And passed to the dump-capture kernel by kernel commandline parameter "savemaxmem=". But in the dump-capture kernel, we never use this parameter now, so remove saved_max_mem and don't add "savemaxmem=" to new kernel commandline. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10add missed options to man pageBaoquan He
several options are missed in man page, add it now. They are --reuseinitrd, --load-preserve-context, --load-jump-back-helper and --entry=<addr>. Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10add description for entry option in help and man pageBaoquan He
"--entry" option is used to specify jump back entry address, but lack description in help message and man page. Now add it. Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-06-10kexec man page change for debug optionBaoquan He
In commit 28d4ab53, the arch-specific --debug are moved to generic place, but the relevant description was not updated accordingly in man page. Here change it. Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-05-26kexec-tools: ppc/ppc64: cleanup: Remove never reached returnZhang Yanfei
The return will never be reached, so remove it. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-05-26kexec/s390: cleanup: Remove non-existent header file includeZhang Yanfei
There is no elf.h in this directory, so remove the useless include. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-05-26kexec/s390: cleanup: Fix a mistaken commentZhang Yanfei
When borrowing codes from ia64 architecture, this comment was forgotten to be change. So fix it. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-05-15kexec: check if memory is reserved only when loading kdump kernel.WANG Chao
When memory for crashkernel isn't reserved, it's confusing that kexec spits error message for unloading kdump kernel as if we were loading it: # kexec -p -u Memory for crashkernel is not reserved Please reserve memory by passing "crashkernel=X@Y" parameter to the kernel Then try loading kdump kernel # echo $? 1 It's more appropriate to test if memory is reserved only when loading kdump kernel. With this patch: # kexec -p -u # echo $? 0 It's also the same behavior with the case of trying to unload kernel from unloaded state. Signed-off-by: WANG Chao <chaowang@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-05-14kexec: Replace printf() with die() to error out to stderrWANG Chao
Error messages are mixed stderr with stdout when we use die() along with printf(). So use die() to keep error out consistent. Signed-off-by: WANG Chao <chaowang@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-30kexec: Parse percpu note size from kernelZhang Yanfei
We used 1024 as the percpu crash note size. But for new kernel that exports the real crash note size, we should parse it instead of using 1024. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-30kexec: cleanup: make add_backup_segments staticZhang Yanfei
The function add_backup_segments is only called by my_load and they are in the same file. So unnecessary to export it. Make it static. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-30Revert "kexec: include reserved e820 sections in crash kernel"Zhang Yanfei
This reverts commit e35aa29fb40b37bf86d980b2e19af5e01c2d2549. This patch is based on the commit 49320340f705694e387d794f7f19d407ad9baefa "kexec: lengthen the kernel command line image" Since the latter commit has been reverted due to its useless, this patch should be reverted too. Besides, This patch also changed a kernel restriction of max segments from 16 to 70. Though kexec-tools could have more segments, more than 16, the kexec_load syscall will still fail for the kernel side has a restriction of 16. Cc: Cliff Wickman <cpw@sgi.com> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-26kdump, x86: Process multiple Crash kernel in /proc/iomemYinghai Lu
Vivek found specical handling crashkernel low in not good. We should extend kexec-tools to handle multiple Crash kernel instead. Extend crash_reserved_mem to array instead and use kexec_iomem_for_each_line directly. After that we can drop crashkernel low. -v2: fix left over calling of parse_iomem_single() found by Vivek. Suggested-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-25kexec/uImage: probe to identify a corrupted imageSuzuki K. Poulose
Teach uImage_probe_xxx() to return the information about a corrupted image. This is required to prevent the loading of a corrupted ramdisk, where we don't have strict checking for the other formats, unlike the kernel. So, we should abort the operation than causing a problem with the new kernel. Without this patch, a corrupted uImage ramdisk is treated as a plain ramdisk where there is no format check involved. # kexec -l uImage --initrd romfs-initrd.corrupt The data CRC does not match. Computed: 867e73f7 expected 8f097cc0 # echo $? 0 # kexec -e Starting new kernel Bye! Reserving 55MB of memory at 70MB for crashkernel (System RAM: 256MB) Using Xilinx Virtex440 machine description Linux version 3.6.0-rc3 (root@suzukikp) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (GCC) ) #66 Tue Apr 16 06:36:56 UTC 2013 Found initrd at 0xcf5f8000:0xcfff8040 ... NET: Registered protocol family 17 RAMDISK: Couldn't find valid RAM disk image starting at 0. List of all partitions: No filesystem could mount root, tried: ext2 cramfs Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) With this patch : # kexec -l uImage --initrd romfs-initrd.corrupt uImage: The data CRC does not match. Computed: 867e73f7 expected 8f097cc0 uImage: Corrupted ramdisk file romfs-initrd With a corrupted kernel image(the behaviour remains the same) : # kexec -l uImage.corrupt --initrd romfs-initrd uImage: The data CRC does not match. Computed: 285787b7 expected e37f65ad Cannot determine the file type of uImage.corrupt Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-17kexec, i386, bzImage: Remove unnecessary symbol value getZhang Yanfei
We needn't get the initial values for every regs in regs32 from symbol entry32_regs for we will manually initialize them one by one next: /* * Initialize the 32bit start information. */ regs32.eax = 0; /* unused */ regs32.ebx = 0; /* 0 == boot not AP processor start */ regs32.ecx = 0; /* unused */ regs32.edx = 0; /* unused */ regs32.esi = setup_base; /* kernel parameters */ regs32.edi = 0; /* unused */ regs32.esp = elf_rel_get_addr(&info->rhdr, "stack_end"); /* stack, unused */ regs32.ebp = 0; /* unused */ regs32.eip = kernel32_load_addr; /* kernel entry point */ Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-17kexec:i386/kexec-[bzImage|elf-x86]:x86_64/kexec-bzImage64: Use "\0" as ↵Wang YanQing
command line instead of empty command line This patch prevents the problems to happen below: In setup_linux_bootloader_parameters_high 120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0'; if cmdline_len == 0, Line 122 will corrupt kernel16 buf just before the commandline. And in do_bzImage_load, for example, 369 cmdline_end = setup_base + kern16_size_needed + command_line_len - 1; 370 elf_rel_set_symbol(&info->rhdr, "cmdline_end", &cmdline_end, 371 sizeof(unsigned long)); Line 369 will go wrong, too. Signed-off-by: Wang YanQing <udknight@gmail.com> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-16kexec/powerpc: Handle buffer overflow in kernel command lineSuzuki K. Poulose
Enforce size check for kernel command line to make sure it doesn't overflow COMMAND_LINE_SIZE. Reported-by: Nathan D. Miller <nathanm2@us.ibm.com> Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-16Add --dtb option to ppc64Geoff Levand
All other architectures use the command line option --dtb to pass a dtb file name. For consistency add that option to ppc64. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-08kexec, i386: Fix build warning of size_t printZhang Yanfei
When compile kexec-tools in i386, we got the following warnings: kexec/kexec-elf-rel.c: In function ‘elf_rel_set_symbol’: kexec/kexec-elf-rel.c:517: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘size_t’ kexec/kexec-elf-rel.c: In function ‘elf_rel_get_symbol’: kexec/kexec-elf-rel.c:541: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘size_t’ This is because the two functions output a size_t value as %ld when it should be %zd, resulting in this warning. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-29kexec: i386: Add cmdline_add_memmap_internal() to reduce the code duplicationZhang Yanfei
Functions: - cmdline_add_memmap() - cmdline_add_memmap_acpi() - cmdline_add_memmap_reserved() is kind of similar, So add a new function cmdline_add_memmap_internal() to hold the common codes, reducing the duplication. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: ppc: Use die() instead of fatal()Zhang Yanfei
fatal() nearly does the same thing as die() does, so this is kind of duplicate. Remove fatal() and use die() instead. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: Use die() to simplify codeZhang Yanfei
Use die() to simplify code. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: fix a minor mistake in an error messageZhang Yanfei
when specified a wrong --entry option, it outputs the error message: "Bad option value in --load-jump-back-helper=%s\n" which is obviously wrong, it should be: "Bad option value in --entry=%s\n" Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: x86_64: elf: fix possible memory leak in elf_x86_64_loadZhang Yanfei
In elf_x86_64_load, allocated memory may not be free'd if the code exits abnormally, by calling die() or return. So the patch fixes the possible memory leak. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: x86_64: elf: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: x86_64: bzImage64: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: ppc: uImage: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: ppc: uImage: fix possible memory leak in ppc_load_bare_bitsZhang Yanfei
In ppc_load_bare_bits, allocated memory may not be free'd if the code exits abnormally, by calling die() or return. So the patch fixes the possible memory leak. This patch is also a preparation for patch10. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: ppc: elf: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: ppc: elf: fix possible memory leak in elf_ppc_loadZhang Yanfei
In elf_ppc_load, allocated memory may not be free'd if the code exits abnormally, by calling die() or return. So the patch fixes the possible memory leak. This patch is also a preparation for patch08. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: i386: multiboot: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: i386: multiboot: fix possible memory leak in multiboot_x86_loadZhang Yanfei
In multiboot_x86_load, allocated memory may not be free'd if the code exits abnormally, by calling return. So the patch fixes the possible memory leak. Besides, remove some extra blank lines. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: i386: elf: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: i386: elf: fix possible memory leak in elf_x86_loadZhang Yanfei
In elf_x86_load, allocated memory may not be free'd if the code exits abnormally, by calling die() or return. So the patch fixes the possible memory leak. This patch is also a preparation for patch04. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: i386: bzImage: fix memory leak caused by get_command_lineZhang Yanfei
Since get_command_line returns dynamically allocated memory, it is easy for the caller to forget freeing the memory. Here fixes a memory leak caused by this function. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec: fix possible memory leak in check_reuse_initrdZhang Yanfei
If the if test is ok, then it will call die() to exit the process, so freeing line will not be reached, causing memory leak. Fix this. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-15kexec: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: ppc64: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: ppc: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Besides, remove the duplicate _ALIGN_* definition in file kexec/arch/ppc/crashdump-powerpc.h. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: x86_64: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: sh: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: s390: remove ALIGN_UP and use _ALIGN_UPZhang Yanfei
We have _ALIGN_UP now, so remove ALIGN_UP and use _ALIGN_UP instead of it. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: mips: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: ia64: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be simplified. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>