patch-2.4.7 linux/fs/binfmt_elf.c

Next file: linux/fs/buffer.c
Previous file: linux/fs/binfmt_aout.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
@@ -888,11 +888,15 @@
  */
 static inline int maydump(struct vm_area_struct *vma)
 {
-	if (!(vma->vm_flags & (VM_READ|VM_WRITE|VM_EXEC)))
+	/*
+	 * If we may not read the contents, don't allow us to dump
+	 * them either. "dump_write()" can't handle it anyway.
+	 */
+	if (!(vma->vm_flags & VM_READ))
 		return 0;
 
 	/* Do not dump I/O mapped devices! -DaveM */
-	if(vma->vm_flags & VM_IO)
+	if (vma->vm_flags & VM_IO)
 		return 0;
 #if 1
 	if (vma->vm_flags & (VM_WRITE|VM_GROWSUP|VM_GROWSDOWN))
@@ -1205,13 +1209,12 @@
 			pte_t *pte;
 
 			pgd = pgd_offset(vma->vm_mm, addr);
+			if (pgd_none(*pgd))
+				goto nextpage_coredump;
 			pmd = pmd_offset(pgd, addr);
-	
-			if (!pmd)
+			if (pmd_none(*pmd))
 				goto nextpage_coredump;
 			pte = pte_offset(pmd, addr);
-			if (!pte)
-				goto nextpage_coredump;
 			if (pte_none(*pte)) {
 nextpage_coredump:
 				DUMP_SEEK (file->f_pos + PAGE_SIZE);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)