summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-12-09mips: use arch_options for both 32 and 64 bit variantsMarcin Nowakowski
At the moment arch_options structure is defined for 64-bit only and is used exclusively in ifdef'ed code. Remove the ifdefs around the uses of the structure and define it for all code variants as it will be used for passing more arch options in the followup commits. Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-12-09mips: remove incorrect arch_usage stringMarcin Nowakowski
arch_usage shows '--elf32-core-headers' as an option, but this is not implemented. Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-12-08kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fixDave Young
I got below error while tesing kexec -p: "Can't find kernel text map area from kcore" The case is the pt_load start addr was same as stext_sym. The checking code should really be saddr <= stext_sym so that the right pt_load area includes stext_sym can be matched. This was not reported by people previously because it will fail over to use hardcode X86_64__START_KERNEL_map to match the pt_load areas again in later code and it sometimes succeeds because of kernel address randomization. With this change according to my test stext_sym checking can garantee falling into right pt_load area if we get correct stext_sym. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-12-02purgatory: Change default sha256 optimization to -O2Geoff Levand
Change the default purgatory sha256 code optimization from -O0 to -O2, and add a new arch specific makefile variable $(ARCH)_PURGATORY_SHA256_CFLAGS which can over ride this default. Set ia64_PURGATORY_SHA256_CFLAGS to -O0 to retain the previous optimization level for ia64. The purgatory sha256 code needs the be built with -O0 for the ia64 architecture. Currently this code is built with -O0 for all architectures, which slows down the calculations for architectures which could otherwise use -O2. On arm64, it takes around 20 second to verify SHA in purgatory when vmlinuz image is around 13MB and initramfs is around 30M with -O2 enabled. Otherwise, it takes more than 2 minutes. Cc: Pratyush Anand <panand@redhat.com> Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-11-07arm64: Add support of R_AARCH64_PREL32 relocation in purgatoryPratyush Anand
gcc version in fedora koji is 6.2.1-2.fc25. kexec-tools compiled with this gcc produced another relocation error: machine_apply_elf_rel: ERROR Unknown type: 261 This patch fixes the above error. Signed-off-by: Pratyush Anand <panand@redhat.com> Reviewed-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-11-07arm64: Add support for additional relocations in the kexec purgatory codeCatalin Marinas
When compiling the kexec-tools with gcc6, the following additional reolcations are generated in the purgatory.ro file: R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64_ADD_ABS_LO12_NC R_AARCH64_LDST64_ABS_LO12_NC This patch modifies the arm64 machine_apply_elf_rel() function to handle these relocations. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-10-13arm64: Add missing kexec dist filesGeoff Levand
Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-10-13arm64: Cleanup kexec MakefileGeoff Levand
Put files in alphabetical order, reformat whitspace. Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-10-07kexec/fs2dt: Check for NULL pointer in dt_copy_old_root_param()Madhavan Srinivasan
In dt_copy_old_root_param(), FILE * returned from fopen is not checked for NULL pointer before passinig to fclose(). This could trigger a segfault. Patch to fix the same. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-10-07multiboot: Use the "reserved" type for non-ram zonesSylvain Munaut
Seems that Xen actually checks for some zones to be 'reserved' and complains if they are not. This also matches what the bios uses at boot. Signed-off-by: Sylvain Munaut <s.munaut@whatever-company.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-10-07multiboot: Fix length computation for the memory zonesSylvain Munaut
Signed-off-by: Sylvain Munaut <s.munaut@whatever-company.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-10-07kexec elf: Sanity check on the note header before accessing itSylvain Munaut
The name[hdr.n_namesz -1] check below can segfault if the header is garbage. So we check the computed header side fits within the expected area before going further. Signed-off-by: Sylvain Munaut <s.munaut@whatever-company.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29arm: include phys_to_virt.h and iomem.h in distributionDave Young
These files are required to build kexec-tools on arm. Signed-off-by: Dave Young <dyoung@redhat.com> [simon: added changelog] Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29kexec: socket not released when error situation occur.YoungHyun Yoo
Fix resourceleek in ifdown function when error occur. Signed-off-by: YoungHyun Yoo <yooyoo.yoo@samsung.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29kexec: fix mem_regions_sort()Pratyush Anand
ranges->ranges is "struct memory_range *", however each element which need to be sorted is of type "struct memory_range". So, correct "size" argument of qsort() as sizeof(*ranges->ranges). Signed-off-by: Pratyush Anand <panand@redhat.com> Acked-by: Russell King <rmk@armlinux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29kexec/arch/i386: Add support for KASLR memory randomizationThomas Garnier
Multiple changes were made on KASLR (right now in linux-next). One of them is randomizing the virtual address of the physical mapping, vmalloc and vmemmap memory sections. It breaks kdump ability to read physical memory. This change identifies if KASLR memories randomization is used by checking if the page_offset_base variable exists. It search for the correct PAGE_OFFSET value by looking at the loaded memory section and find the lowest aligned on PUD (the randomization level). Related commits on linux-next: - 0483e1fa6e09d4948272680f691dccb1edb9677f: Base for randomization - 021182e52fe01c1f7b126f97fd6ba048dc4234fd: Enable for PAGE_OFFSET Signed-off-by: Thomas Garnier <thgarnie@google.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29arm64: Add support for binary image filesPratyush Anand
Signed-off-by: Pratyush Anand <panand@redhat.com> [Reworked and cleaned up] Signed-off-by: Geoff Levand <geoff@infradead.org> Tested-By: Pratyush Anand <panand@redhat.com> Tested-By: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29arm64: Add arm64 kexec supportGeoff Levand
Add kexec reboot support for ARM64 platforms. Signed-off-by: Geoff Levand <geoff@infradead.org> Tested-By: Pratyush Anand <panand@redhat.com> Tested-By: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29kexec: Add common device tree routinesGeoff Levand
Common device tree routines that can be shared between all arches that have device tree support. Signed-off-by: Geoff Levand <geoff@infradead.org> Tested-By: Pratyush Anand <panand@redhat.com> Tested-By: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29kexec-tools 2.0.13.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>
2016-08-08kexec-tools 2.0.13Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-07-29kexec-tools 2.0.13-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-07-15arm: use zImage size from headerRussell King
We do not support zImage with an appended DTB as we need to supply our own DTB to the kernel, and an appended DTB will override any that we try to supply. To ensure that we do not load an appended DTB, clamp the kernel size to the size specified in the zImage header. Signed-off-by: Russell King <rmk@armlinux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-07-15arm: plug a zImage corner caseRussell King
If a zImage is built with ARM_APPENDED_DTB enabled, the zImage will look at the word following the zImage and check whether it contains the DTB magic number. Generally, kexec will clear the destination pages before copying the zImage, but there is a corner case where the zImage is a multiple of the page size, where the following page will not be touched. Should the first word in this page contain the DTB magic number, the data following will be interpreted as a DTB image. In order to make this bullet-proof, we must always initialise the word following the zImage. Arrange this by specifying the zImage memory size one word bigger than the buffer size. Signed-off-by: Russell King <rmk@armlinux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-23arm: fix kernel image sizeRussell King
If we want to assume that the compressed image will expand by a maximum of 4x, we actually need to reserve 5x the space, since we need to keep a copy of the compessed image around while decompressing. Signed-off-by: Russell King <rmk@armlinux.org.uk> Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-23arm: take account of TEXT_OFFSET for subsequent imagesRussell King
The ARM kexec code was not taking account of the 32k text offset when applying the size(s) of the kernel image. We need to take account of this so when we decide to place the initrd at 4x the compressed image length, it is appropriately placed. Signed-off-by: Russell King <rmk@armlinux.org.uk> Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-23Remove "max" parameter commentRussell King
Remove the "max" parameter in the documentation for mem_regions_add() Signed-off-by: Russell King <rmk@armlinux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: report which ELF core format we will useRussell King
Report which ELF core format will be used to create the template ELF core dump in the debug information. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: clean up phys/page offset debugRussell King
Clean up the physical and page offset debug prints. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: fix type of phys_offsetRussell King
Some LPAE systems may have phys_offset above the 4GB mark. Hence, we need phys_offset to be a 64-bit integer. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: add debug of reserved and coredump memory rangesRussell King
Add debug of the reserved and coredump memory ranges for validation. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: add support for boot-time crash kernel resourceRussell King
Add support for detecting and using the boot-time crash kernel resource, which is needed for systems which have special boot-time memory views, such as Keystone 2. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: add support for multiple reserved regionsRussell King
Add support for reserving multiple memory regions rather than just a single region. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: rename crash_reserved_mem to crash_kernel_memRussell King
Rename crash_reserved_mem to crash_kernel_mem as we want to support multiple reserved memory ranges. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: crashdump needs boot alias of crash kernel regionRussell King
When crashdumping, we need the boot memory alias of the crash kernel region rather than the system view. Arrange to check for the boot alias of the crash kernel region first, and if found, use it instead of the main alias. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: add support for platforms with boot memory aliasesRussell King
The kexec API deals with boot-view addresses, rather than normal system view addresses. This causes problems for platforms such as Keystone 2, where the boot view is substantially different from the normal system view. This is because Keystone 2 boots from a memory alias in the lower 4GiB, before switching to a high alias at 32GiB. We handle this in a generic way by introducing boot alias resources in /proc/iomem: 80000000-dfffffff : System RAM (boot alias) 9f800000-9fffffff : Crash kernel (boot alias) 800000000-85fffffff : System RAM 800008000-800790e37 : Kernel code 8007ec000-8008b856f : Kernel data 81f800000-81fffffff : Crash kernel To allow kexec to load a kernel, we need to add the boot alias of RAM to the memory ranges returned by get_memory_ranges(). Parse the system RAM boot alias into the memory ranges. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: move crash system RAM parsing earlierRussell King
Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: use generic mem_region sorting implementationRussell King
Use the generic mem_region sorting implementation. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: parse crash_reserved_mem earlyRussell King
We parse the crash kernel memory region in several locations in the kexec tools - once to check that there's a region, another time for real when we're locating the memory regions to dump, and another while loading the image. Move the real parsing step to is_crashkernel_mem_reserved(), which matches what x86 is doing. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: add maximum number of memory rangesRussell King
Add the maximum number of memory ranges to the list of usable memory ranges, so that we don't have to carry this around. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: add memory ranges debugRussell King
Add the call to dbgprint_mem_range() into the ARM version of get_memory_ranges(). Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: report if crash kernel is out of boundsRussell King
Report an error if the crash kernel memory region is outside of the boot-view memory range - this can happen with systems such as Keystone 2. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: return proper error for missing crash kernelRussell King
Return the proper error code (ENOCRASHKERNEL) for a missing crash kernel region in /proc/iomem, so the error handling in kexec.c can print the appropriate message. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: fix ELF32/ELF64 checkRussell King
Rather than using ULONG_MAX to decide whether to use the ELF64 or ELF32 core dump format, use UINT32_MAX instead - we include stdint.h, so we might as well use a constant which is meaningful for the limits of the 32-bit ELF format. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: fix get_kernel_stext_sym() to close its fileRussell King
Fix get_kernel_stext_sym() so that it closes its file once it's finsihed with it - there's no need to leak file descriptors. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: fix off-by-one on memory endRussell King
The memory range end is inclusive, not exclusive (see x86). We should not be adding one to the value parsed from the /proc/iomem resources. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08arm: fix pointer signedness warning in kexec-uImage-arm.cRussell King
kexec/arch/arm/kexec-uImage-arm.c: In function 'uImage_arm_probe': kexec/arch/arm/kexec-uImage-arm.c:14:2: warning: pointer targets in passing argument 1 of 'uImage_probe_kernel' differ in signedness [-Wpointer-sign] Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08kexec: add helper to exlude a region from a set of memory rangesRussell King
Add a helper to exclude a region from a set of memory ranges. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08kexec: add mem_regions sorting implementationRussell King
Add a mem_regions sorting implementation taken from the arm code. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-06-08kexec: add generic helper to add to memory_regionsRussell King
Add a helper to add a memory range to a memory_regions array. Reviewed-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Simon Horman <horms@verge.net.au>