summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-09-25fix kexec load hang in case crash notes addr read failureDave Young
While readng crash note, count_cpu variable will be never decreased in case any failure to read the sysfs file. The issue was found during I test CONFIG_KEXEC_FILE only kernel option. crash_notes are exported to sysfs only for CONFIG_KEXEC. In latest kernel we can configure kernel with CONFIG_KEXEC_FILE only in Kconfig. In this case, if you run a kernel with kexec_file only but do not specify "-s" in kexec-tools arguments, then kexec-tools will hang there. Though "-s" is mandatory for kexec_file_load, kexec should still fail out instead of hanging. Fixing the problem by always decreasing count_cpu in the for loop. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-09-07kexec: use mmap instead of read for slurp_file()Michael Holzheu
The slurp_fd() function allocates memory and uses the read() system call. This results in double memory consumption for image and initrd: 1) Memory allocated in user space by the kexec tool 2) Memory allocated in kernel by the kexec() system call Therefore use mmap() for non-character devices to reduce the runtime memory consumption of the kexec tool. The following use case illustrates the usefulness of this patch a bit more: 1) Boot a 4 GB Linux system 2) Read kernel and 1,5 GB ramdisk from external source into local tmpfs (ram) 3) kexec the kernel and ramdisk Without this patch for the kexec runtime we need: 1,5 GB (tmpfs) + 1,5 GB (kexec malloc) + 1,5 GB (kernel memory) = 4,5 GB Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-09-04ppc64: purgatory: Reset primary cpu endian to big-endianSamuel Mendoza-Jonas
Older big-endian ppc64 kernels don't include the FIXUP_ENDIAN check, meaning if we kexec from a little-endian kernel the target kernel will fail to boot. Returning to big-endian before we enter the target kernel ensures that the target kernel can boot whether or not it includes FIXUP_ENDIAN. This mirrors commit 150b14e7 in kexec-lite. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-09-02Drop release date from kexec-tools version outputDave Young
kexec --version reports like below: kexec-tools 2.0.7 released 05 February 2015 The date string is generated when one run bootstrap script, thus it is more like a build date instead of release date. Even for distribution like Fedora it will make more sense if it can report something like "kexec-tools 2.0.7-1 released 05 February 2015" In case building from git tree, the date cause more confusion. So let's remove it from version string unless there is better idea to resolve the issue. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-09-02Add persistent memory supportBaoquan He
Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device. Now support them in kexec too. Reported-by: Toshi Kani <toshi.kani@hp.com> Tested-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-08-13kexec: use _DEFAULT_SOURCE instead to remove compiling warningBaoquan He
Now compiling will print warning like below. Change code as it suggested. # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^ Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-06-25kexec-tools 2.0.10.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2015-06-25kexec-tools 2.0.10Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-06-11kexec-tools 2.0.10-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-05-01Revert "x86_64: Add support to build kexec-tools with x32 ABI"Simon Horman
This reverts commit 5edcbfd1368e84fce913ceeeca7b712c524dc20d. Yinghai Lu has reported on the kexec mailing list that this causes the following problem when using kexec load with kexec built on openSUSE 13.1 64bit. overflow in relocation type R_X86_64_32 val 21dffc020
2015-04-30purgatory: force PIC/PIE/SSP offMike Frysinger
If the toolchain has these things turned on automatically, then the purgatory code might be miscompiled leading to runtime errors like: Unhandled rela relocation: R_X86_64_GOTPC64 It might look like the problem is with the kernel when in reality, kexec is complaining about the purgatory module. Force off harden features that don't make sense in kernel space. Signed-off-by: Mike Frysinger <vapier@chromium.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-04-23purgatory: Fix memcmp for src address incrementPratyush Anand
src addresses are not being incremented, so only first byte is compared instead of first len bytes. Signed-off-by: Pratyush Anand <panand@redhat.com> Acked-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-04-15kexec: remove ordering constraints from -x (--no-ifdown) and -y (--no-sync)Tejun Heo
Currently, the two options must be the last ones to be honored; otherwise, they can get silently ignored and both the manpage and help text point it out. This is error-prone and trivial to fix. There isn't much point in pointing something out in documentation when the peculiarity can be removed with four lines of extra code. Update option handling so that the two arguments are honored regardless of their positions. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-04-15kexec: implement -y (--no-sync) optionTejun Heo
During kernel develoment, kexec can be used to get out of sticky situations without going through possibly lenghty reboot; however, there are situations where the filesystem and/or storage stack are known to be misbehaving and performing sync before kexecing is dangerous or just never finishes. This patch implement -y (--no-sync) option which makes kexec skip syncing in the similar way as -x (--no-ifdown). Signed-off-by: Tejun Heo <tj@kernel.org> Suggested-by: Chris Mason <clm@fb.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-04-09configure.ac: Fix failure caused by x32 ABI testAníbal Limón
When try to compile with zlib fails due to configure.ac bad expansion caused by x32 ABI test that needs AC_PROG_CC for use AC_EGREP_CPP. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-04-07x86_64: Add support to build kexec-tools with x32 ABIAníbal Limón
Summary of changes, configure.ac: Add test for detect x32 ABI. purgatory/arch/x86_64/Makefile: Not use mcmodel large when x32 ABI is set. kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set use ELFCLASS32 instead of ELFCLASS64. kexec/kexec-syscall.h: Add correct syscall number for x32 ABI. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-03-19x86: Remove unnecessary res variable from efi_map_addedSimon Horman
gcc 4.9.1 tells me this variable is set but unused Signed-off-by: Simon Horman <horms@verge.net.au>
2015-03-19purgatory: Add printf type checkingGeoff Levand
To better catch coding problems add stricter type checking to the purgatory printf routines. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-03-19purgatory: Generate map fileGeoff Levand
To aid in debugging purgatory and its relocation generate a linker map file when purgatory is built. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-03-19purgatory: Generate symbol fileGeoff Levand
To aid in debugging purgatory update its makefile to generate a stand alone symbol file that can me loaded by a debugger. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-03-19purgatory: Add no-zero-initialized-in-bss flagGeoff Levand
It seems some toolchains will put zero-initialized variables like purgatory's sha256_regions into the BSS section. These symbols cannot be processed by machine_apply_elf_rel() and lead to build errors. To avoid this problem add the compiler flag no-zero-initialized-in-bss to the purgatory CFLAGS. Fixes build errors like these: Symbol: sha256_regions is in a bss section cannot set Reported here: http://lists.infradead.org/pipermail/kexec/2014-November/013052.html Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-25kexec: iomem: fix callbacks params for sh and x86 archsRoman Pen
Commit 4362bfac changes params for kexec_iomem_for_each_line from 'unsigned long' to 'unsigned long long'. This patch fixes forgotten changes for sh and x86 archs. Bug causes incorrect parsing of memory ranges. Signed-off-by: Roman Pen <r.peniaev@gmail.com> Cc: kexec@lists.infradead.org Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-25i386: elf: Fix -Wunused-but-set-variable compilation warningAmeya Palande
kexec/arch/i386/kexec-elf-x86.c:97:6: warning: variable ‘modified_cmdline_len’ set but not used [-Wunused-but-set-variable] int modified_cmdline_len; Signed-off-by: Ameya Palande <2ameya@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-25i386: bzImage: Fix -Wunused-but-set-variable compilation warningAmeya Palande
kexec/arch/i386/kexec-bzImage.c:111:8: warning: variable ‘kernel_version’ set but not used [-Wunused-but-set-variable] Signed-off-by: Ameya Palande <2ameya@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-18kexec: Fix compiler format warningGeoff Levand
The sizeof operator returns a size_t type. Change the printf format of sizeof values from %d to %zu. Fixes compiler warnings like these: kexec/fs2dt.c: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=] Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-18kexec: Fix compiler ambiguous else warningGeoff Levand
Add braces to if statments in fs2dt.c. Fixes warnings like these when compiling with gcc 4.9.1: kexec/fs2dt.c: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses] Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-11mips: remove unused variable.Yousong Zhou
Fixes the following compilation warning. kexec/arch/mips/crashdump-mips.c:151:6: warning: unused variable 'i' [-Wunused-variable] Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-12mips: fix warning about implicit type conversion.Yousong Zhou
Fixes the following warning. kexec/arch/mips/kexec-elf-mips.c:161:16: warning: assignment makes integer from pointer without a cast [enabled by default] Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-12mips: fix compiler warning on printing 64-bit integer.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-12configure.ac: apply necessary quotes to result of macro expansion.Yousong Zhou
This can fix the following error when searching for lzma support and while at it also apply the practice to other uses of the same pattern. checking for lzma_code in -llzma... ./configure: line 4756: ac_fn_c_try_link: command not found Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-12multiboot: fix crash on NULL kernel command lineAmeya Palande
If "--command-line" option is not specified, then kexec segfaults while dereferencing NULL command line string pointer. While we are at it, also fix indentation and use '{' and '}' consistently. Signed-off-by: Ameya Palande <2ameya@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-09Fix zlib/lzma decompression.Yousong Zhou
Let {zlib,lzma}_decompress_file() return NULL if anything wrong happened to allow the other method to have a chance to run. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-09ppc64: erase unnecessary segment info printingBaoquan He
In ppc64 loading, it will print the segment information. This is not wanted since other Archs don't have this. People even think there's something wrong. So erase it to make it be consistent with other Archs. And if people really want to check these info, they can specify "-d" option. They are printed in print_segments() too. Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-09kexec-tools 2.0.10.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-09kexec-tools 2.0.9Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-01-27kexec-tools 2.0.9-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-01-05Revert "kexec, remove panic_on_warn kernel parameter from kdump situations"Simon Horman
This reverts commit 930f0c3734c223433e74037601cbfd1bc9df7bad.
2015-01-01kexec, remove panic_on_warn kernel parameter from kdump situationsPrarit Bhargava
panic_on_warn kernel parameter will cause the kernel to panic when a WARN() is hit in the kernel. This is not a good situation for the kdump kernel because then it would be possible for the kdump kernel to panic in a non-fatal WARN(). This patch removes panic_on_warn as a kernel parameter for the kdump kernel. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: WANG Chao <chaowang@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-12-02kexec/fs2dt: Use slurp_file_len to avoid partial read of filesAnton Blanchard
The OPAL firmware is going to embed its symbol map in the device tree. The size is large enough to be more than a page, and it takes multiple reads to get the whole file. This is because sysfs uses the seq_file helpers which do a page at a time. Unfortunately fs2dt has no handling for short reads and we die with: unrecoverable error: short read from"/proc/device-tree//ibm,opal/firmware/symbol-map" This patch uses the slurp_file_len helper which does the right thing. It moves the explicit open of the file further down for add_usable_mem_property and add_dyn_reconf_usable_mem_property. We should convert both of these to use the buffer provided by slurp_file_len at some stage. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-12-02kexec: remove some re zero-assignmentHuKeping
since we have already cleared kexec_info with memset, there is no need to do that again to the struct members. Signed-off-by: Hu Keping <hukeping@huawei.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-11-13kexec/fs2dt: Fix sorting of device treeAnton Blanchard
Commit b02d735bf252 ('ppc64 kdump device_tree sort') added code to sort device tree properties, but it had a few issues. A compare routine needs to return -1 and 1. The special case for sorting properties with unit addresses only returned 1 and ignored the opposite case, which screwed up the sorting. We were missing a few more things: - Need to check both basenames are the same length - Need to check both basenames match I noticed this when looking at the NUMA topology after a kexec, and it had shifted. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-14kexec: distribute kexec/arch/m68k/bootinfo.hAndreas Schwab
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-14kexec-tools 2.0.8.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-08kexec-tools 2.0.8Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-01kexec-tools 2.0.8-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-09-04Return error code in case of invalid command line optionVivek Goyal
Currently kexec returns success even if an invalid command line option is encountered. Kexec currently prints usage message and then returns 0. That's not right. It is an error and error code 1 should be returned. Due to this wrapper script thinks that kdump succeeded but that's not the case. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-09-01ppc64/kdump: Fix ELF header endianessLaurent Dufour
The ELF header created among the loading of the kdump kernel should be flagged using the current endianess and not always as big endian. Without this patch the data exposed in /proc/vmcore are not readable when running in LE mode. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-08-27kexec: Provide an option to use new kexec system callVivek Goyal
Hi, This is v2 of the patch. Since v1, I moved syscall implemented check littler earlier in the function as per the feedback. Now a new kexec syscall (kexec_file_load()) has been merged in upstream kernel. This system call takes file descriptors of kernel and initramfs as input (as opposed to list of segments to be loaded). This new system call allows for signature verification of the kernel being loaded. One use of signature verification of kernel is secureboot systems where we want to allow kexec into a kernel only if it is validly signed by a key system trusts. This patch provides and option --kexec-file-syscall (-s), to force use of new system call for kexec. Default is to continue to use old syscall. Currently only bzImage64 on x86_64 can be loaded using this system call. As kernel adds support for more arches and for more image types, kexec-tools can be modified accordingly. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Baoquan He <bhe@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-07-24kexec: align the extended size of dtbLiu Hua
When loading dtb on arm platform, we may need change strings in dtb in function setup_dtb_prop. If length of new string is larger than that of the old one. We should extend the dtb by "FDT_TAGALIGN"ed size. If not, kexec may fail to load the capture kernel. Signed-off-by: Liu Hua <sdu.liu@huawei.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-07-23kexec/ppc64: disabling exception handling when building the purgatoryLaurent Dufour
Some Linux distributions would like to turn on the GCC exception handling by default. As this option introduces symbols in the built code that are defined in a separate shared library, this is not a good idea to have such an option activated when building the purgatory. This patch forces the exception handling to be turned off when building the purgatory on ppc64 BE and LE. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>