Age | Commit message (Collapse) | Author |
|
Since kernel commit a5980d064fe2 ("powerpc: Bump COMMAND_LINE_SIZE
to 2048"), powerpc bumped command line size to 2048 but the size
used here is still the default value of 512. Bump it to 2048 to
fix command line overflow errors observed when command line length
is above 512 bytes. Also, get rid of the multiple definitions of
COMMAND_LINE_SIZE macro in ppc architecture.
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Enable compiling kexec-tools for ppc with -Werror=format-security.
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This was only ever used on PPC, where they are equivalent and we
never saw the resulting -Wpointer-sign warnings.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Implement get_crash_kernel_load_range() in support of
print crash kernel region size option.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On PowerPC64 ABIv2 we need to look at the symbol to determine
if it has a local entry point. Pass struct mem_sym into
machine_apply_elf_rel() so we can.
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Previously when sorting the device tree directory entries, if both
device tree entries contained the '@' character then comparison was
made based on the length of the strings.
This did not work in all cases and could result in odd orderings.
This patch modifies the comparison function for the case when both
strings contain the '@' character.
First a lexical comparison is made between the prefix portions of the
strings *before* the '@' character.
Next, if the prefixes are equal, the lengths of the suffixes *after*
the '@' character are compared. This preserves the intent of the
original code.
Next, if the suffix lengths are equal, a lexical comparison of the
suffixes is made.
This is still not strictly correct, as ideally the portion after the
'@' should be compared numerically. However, determining what base to
use for all case is difficult.
Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On PowerNV platform, OPAL region is overlapped with crashkernel, need to
create ELF Program header for the overlapped memory. The changes are
similar to the way RTAS region was handled.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Move filling crash_memory_range table entries into a separate routine,
which saves quite a few lines of code.
In this routine, if range spawns over lowmem-highmem border, split range
into two. This is needed to get proper virtual address for lowmem part.
Similar thing is already done for x86. Credits to Yadviga Grigorieva
<yadviga@dev.rtsoft.ru> for tracking down this issue for ppc.
Also this patch makes excluding crash kernel regoin a bit shorter, and
removes unused variable to get rid of compiler warning.
Signed-off-by: Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The main kexec option code handles the -? option. Remove all the
duplicate -? handlers in the arch code which are never used.
Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
We should check if the initrd is in uImage format, when
the kernel might be in ELF.
Signed-off-by : Suzuki K Poulose <suzuki@in.ibm.com>
Signed-off-by : Athira Rajeev<atrajeev@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If the primary kernel doesn't use an initrd,
we may not have linux,initrd-* entries in the
device-tree, and hence the initial flat tree
may not contain them.
Make sure we add the entries in the dtb if the
second kernel needs an initrd.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Athira Rajeev<atrajeev@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Use die() to simplify code.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
We have defined the global align macros for use, so remove the
duplicated macros here.
And in file kexec/arch/ppc/include/page.h, we directly expand the
align operation for marco PAGE_ALIGN since we have removed marco
_ALIGN in this file.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Handle the RAM Disks in uImage format
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
uImage supports different types of payloads, including kernel,
ramdisks etc. uImage_probe() as of now checks whether the supplied
payload is of type KERNEL ( i.e, IH_TYPE_KERNEL or IH_TYPE_KERNEL_NOLOAD ).
Change this behaviour to return the image type, if it is one of the supported
payloads. This change is in prepartion to support ramdisks in uImage format.
Introduce a uImage_probe_kernel() which can be used by the archs to check if
the supplied payload is one of the KERNEL types.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
So far powerpc kernel never exported memory limit information which is
reflected by mem= kernel cmdline option. Hence, kexec-tools always used
to build ELF header for entire system RAM generating a dump bigger than
the actual memory used by the first kernel.
This patch now reads the memory limit information from device-tree file and
limits the crash memory ranges accordingly.
Suzuki tested this patch on ppc32(ppc440) with a kernel patch by Suzuki.
The following are the upstream kernel commits that exports memory limit
information through /proc/device-tree file:
4bc77a5ed - powerpc: Export memory limit via device tree
a84fcd468 - powerpc: Change memory_limit from phys_addr_t to unsigned
long long
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Tested-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
uImage probe fills the entry point (ep) based on the load_addr
from the uImage headers. If we change the load_addr, we should
accordingly update the entry point.
For ELF, calculate the offset of e_entry from the virtual start
address and add it to the physical start address to find the
physical address of kernel entry.
i.e,
pa (e_entry) = pa(phdr[0].p_vaddr) + (e_entry - phdr[0].p_vaddr)
= kernel_addr + (e_entry - phdr[0].p_vaddr)
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Restrict the scope of compiler flags set in per-arch Makefiles
to the architecture the Makefile belongs to.
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Anders Hedlund <anders.j.hedlund@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
execstack shows ppc kexec has an executable stack,
this leaves it vulnerable to buffer overflows.
Fix it by adding ASFLAGS --noexecstack
Tested on PowerMac G4 Macmini:
Without the patch:
dave@darkstar:~/kexec-tools$ execstack build/sbin/kexec
X build/sbin/kexec
With the patch:
dave@darkstar:~/kexec-tools$ execstack build/sbin/kexec
- build/sbin/kexec
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If the kernel cannot be loaded at the default load_addr, provided
by the image, we should try finding a free area using locate_hole().
This is usually applicable for the CRASH case, where the memory should
be located in the reserved region.
Without this patch, sometime the kernel fails to load for uImage formatted
relocatable kernel images.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This is in preparation for using the code on ARM as well as PPC.
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
As of now, the kexec reserves the spin-table for all the CPUs
on an SMP machine. The spin-table is pointed to by the
cpu-release-addr property in the device-tree. Reserving the
spin-table in the crash kernel will cause a BUG(), if the table
lies outside the memory reserved for the crashkernel.
Disable reserving the spin-table regions and use maxcpus=1 to
use only the crashing CPU to boot the crash kernel.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
From: Cong Wang <xiyou.wangcong@gmail.com>
V2: Fix a compile error
Like commit 28d4ab53280853d2aeefdfb7c369331e89ab9ac2
("Add generic debug option"), this one moves code
under #if DEBUG to --debug on ppc arch.
Sorry that I still can't find a ppc32 machine to test this.
Cc: Simon Horman <horms@verge.net.au>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Currently the debugging code is under #ifdef DEBUG, which
means when we want to debug, we have to re-compile the source
code with -DDEBUG. This is not convenient, we want to have
a generic --debug option so that we can enable debugging code
without re-compiling.
This patch moves the arch-specific --debug to generic place
and moves code under #ifdef DEBUG to --debug on x86.
BTW, the size of kexec binary increases very little after this patch.
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Use automatic variables for prerequisites when copying man pages and
include a makefile relative to $(srcdir).
Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Disable backup regions for BookE in case of a CRASH Dump, as they can
be run from anywhere.
The patch introduces --with-booke option to support the BookE.
With the patch, we get :
## On a 256M machine:
# busybox cat /proc/cmdline
init=/bin/init console=ttyS0,16550 crashkernel=128M@100M
# kexec -p root/vmlinux
usable memory rgns size:1 base:6400000 size:8000000
CRASH MEMORY RANGES
0000000000000000-0000000006400000
000000000e400000-0000000010000000
Command line after adding elfcorehdr: elfcorehdr=112380K
Command line after adding elfcorehdr: elfcorehdr=112380K savemaxmem=256M
Signed-off-by: Suzuki K. Poulose<suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
commit 1ea7cfd435aba0e095886db367e9616271f56c28 broke the ppc build as it removes
the declaration for two variables in use by the elf_ppc_load(). This patch reverts
the particular hunk.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Reported-by: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
PPC32 ELF ABI expects r2 to be loaded with Thread Pointer, which is 0x7000
bytes past the end of TCB. Though the purgatory is single threaded, it uses
TCB scratch space in vsnprintf(). This patch allocates a 1024byte TCB
and populates the TP with the address accordingly.
Changes from V2: Avoid address overflow in TP allocation.
Changes from V1: Fixed the addr calculation for uImage support.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Ryan S. Arnold <rsa@us.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The format of memory/reg is based on the #address-cells,#size-cells. Currently,
the kexec-tools doesn't use the above values in parsing the memory/reg values.
Hence the kexec cannot handle cases where #address-cells, #size-cells are
different, (for e.g, PPC440X ).
This patch introduces a read_memory_region_limits(), which parses the
memory/reg contents based on the values of #address-cells and #size-cells.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: WANG Cong <amwang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Fixes buffer overflow and improper realloc() in realloc_memory_ranges().
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
(manually applied)
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Vivek pointed out that we have duplicated ->backup_src_start
in struct crash_elf_info and struct kexec_info.
This patch removes the ->backup_src_start and ->backup_src_end
from struct crash_elf_info.
I tested it on both i686 and ppc64, and used a test case from
Dave Anderson to confirm the backup region is correct on i686.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
It was possible to not add enough space when we allocate
more space for more memory reserve regions, this was because
we were incorrectly accounting for the size of a reserve
region. This corrects the assumed size for a resize region
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
We always remove the old entry, and add it back if it is needed
on for the kexec'ed kernel
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Currently, we can add a lot of reservations over a small range, this
does a simple check to verify the previous entry is not the same
as the current one and skips it if so
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Currently, the device tree is passed as is. You can optionally
update the command line and specifically listed nodes but nothing
is updated automatically.
This patch updates the memreserve regions, memory node, initrd
nodes and attempts to make the device tree look as it should. Some
code is borrowed from the u-boot routines which do similiar things
Also, now if no flat device tree is passed to kexec it will attempt
to rebuild one from the /proc/device-tree file system to use for
the kexec'ed kernel for both uImage and elf formats
[ horms@verge.net.au: kernel_addr is now outside #ifdef WITH_GAMECUBE ]
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|