summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2011-12-01 09:56:11 +0100
committerSimon Horman <horms@verge.net.au>2011-12-02 09:41:31 +0900
commit4f1ac81354d95a1fa35af67da5bf6cc30d0122dd (patch)
tree6f45dd287e6aae8815fb69aff2d98a59853e3a73
parent7d979c660817a1b31bcc198c8c82dc80083273f6 (diff)
kexec skips some load segments on ia64
There is a bug in add_loaded_segments_info, which causes that some LOAD segments may be skipped on ia64. For two consecutive segments which cannot be combined, the 'i' counter is incremented twice, effectively skipping over the second segment. For example, these are the program header of my vmlinux: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000010000 0xa000000100000000 0x0000000004000000 0x0000000000ee0e90 0x0000000000ee0e90 RWE 10000 LOAD 0x0000000000f00000 0xfffffffffffc0000 0x0000000004f00000 0x0000000000006d80 0x0000000000006d80 RW 10000 LOAD 0x0000000000f10000 0xa000000100f40000 0x0000000004f40000 0x00000000005e3028 0x0000000000dc9198 RW 10000 NOTE 0x000000000098dc60 0xa00000010097dc60 0x000000000497dc60 0x0000000000000024 0x0000000000000024 R 4 IA_64_UNWIND 0x00000000009edd58 0xa0000001009ddd58 0x00000000049ddd58 0x000000000005d468 0x000000000005d468 R 8 And these are the resulting load segments: 0x6004000000 - 0x6004ef0000 (LOAD 1) 0x6004f40000 - 0x6005d10000 (LOAD 3) 0x6023fc0000 - 0x6023fc1000 (elfcorehdr) Note: The crash kernel is loaded at 0x6004000000 on this machine. Signed-off-by: Petr Tesarik <ptesarik@suse.cz> [horms@verge.net.au: Trivial up-port] Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/ia64/crashdump-ia64.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c
index 8932395..782f49e 100644
--- a/kexec/arch/ia64/crashdump-ia64.c
+++ b/kexec/arch/ia64/crashdump-ia64.c
@@ -73,12 +73,14 @@ static int seg_comp(const void *a, const void *b)
*/
static void add_loaded_segments_info(struct mem_ehdr *ehdr)
{
- unsigned i;
- for(i = 0; i < ehdr->e_phnum; i++) {
+ unsigned i = 0;
+ while(i < ehdr->e_phnum) {
struct mem_phdr *phdr;
phdr = &ehdr->e_phdr[i];
- if (phdr->p_type != PT_LOAD)
+ if (phdr->p_type != PT_LOAD) {
+ i++;
continue;
+ }
loaded_segments[loaded_segments_num].start =
phdr->p_paddr & ~(ELF_PAGE_SIZE-1);