From 367e82de44e6bbc297369ac2aee5cff212b9eddc Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 6 Oct 2003 17:53:26 -0700 Subject: [PATCH] [PATCH] fix ia64 core dump code From: Roland Turner Fixes a BUG which occurs when an ia64 application tries to dump core. --- include/asm-ia64/elf.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h index cebb025766c24..9364bb2ee060f 100644 --- a/include/asm-ia64/elf.h +++ b/include/asm-ia64/elf.h @@ -218,19 +218,22 @@ do { \ #define ELF_CORE_EXTRA_PHDRS (GATE_EHDR->e_phnum) #define ELF_CORE_WRITE_EXTRA_PHDRS \ do { \ - const struct elf_phdr *const vsyscall_phdrs = \ + const struct elf_phdr *const gate_phdrs = \ (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \ int i; \ - Elf32_Off ofs = 0; \ + Elf64_Off ofs = 0; \ for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \ - struct elf_phdr phdr = vsyscall_phdrs[i]; \ + struct elf_phdr phdr = gate_phdrs[i]; \ if (phdr.p_type == PT_LOAD) { \ - BUG_ON(ofs != 0); \ - ofs = phdr.p_offset = offset; \ phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \ phdr.p_filesz = phdr.p_memsz; \ + if (ofs == 0) { \ + ofs = phdr.p_offset = offset; \ offset += phdr.p_filesz; \ } \ + else \ + phdr.p_offset = ofs; \ + } \ else \ phdr.p_offset += ofs; \ phdr.p_paddr = 0; /* match other core phdrs */ \ @@ -239,13 +242,15 @@ do { \ } while (0) #define ELF_CORE_WRITE_EXTRA_DATA \ do { \ - const struct elf_phdr *const vsyscall_phdrs = \ + const struct elf_phdr *const gate_phdrs = \ (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \ int i; \ for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \ - if (vsyscall_phdrs[i].p_type == PT_LOAD) \ - DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \ - PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \ + if (gate_phdrs[i].p_type == PT_LOAD) { \ + DUMP_WRITE((void *) gate_phdrs[i].p_vaddr, \ + PAGE_ALIGN(gate_phdrs[i].p_memsz)); \ + break; \ + } \ } \ } while (0) -- 2.53.0