Skip to contentSkip to conversation

fix vsyscall page core dump segment size

PATCH New Roland McGrath 1 participant 1 message May 16, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix vsyscall page core dump segment size

My change to core dumps that was included with the vsyscall DSO implementation had a bug (braino on my part). Core dumps don't include the full page of the vsyscall DSO, and so don't accurately represent the whole memory image of the process. This patch fixes it.

arch/x86_64/ia32/ia32_binfmt.c's copy of this code needs the corresponding update as well. I don't include a patch since that code is not in the main tree.

Thanks,
Roland

include/asm-i386/elf.h renamed from include/asm-i386/elf.h.~1~ +4 -1
@@ -149,7 +149,10 @@ do {									      \
 	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
 		struct elf_phdr phdr = vsyscall_phdrs[i];		      \
 		if (phdr.p_type == PT_LOAD) {				      \
+			BUG_ON(ofs != 0);				      \
 			ofs = phdr.p_offset = offset;			      \
+			phdr.p_filesz = PAGE_ALIGN(phdr.p_filesz);	      \
+			phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);	      \
 			offset += phdr.p_filesz;			      \
 		}							      \
 		else							      \
@@ -167,7 +170,7 @@ do {									      \
 	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
 		if (vsyscall_phdrs[i].p_type == PT_LOAD)		      \
 			DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,	      \
-				   vsyscall_phdrs[i].p_filesz);		      \
+				   PAGE_ALIGN(vsyscall_phdrs[i].p_filesz));   \
 	}								      \
 } while (0)