]> git.neil.brown.name Git - history.git/commitdiff
Make core-dumps have all the relevant regions in it.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 21 Oct 2004 08:26:51 +0000 (01:26 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Thu, 21 Oct 2004 08:26:51 +0000 (01:26 -0700)
Based on input from Roland McGrath and Hugh Dickins.

This simplifies the logic, and takes advantage of the
"new" VM information in the form of vma->anon_vma.

fs/binfmt_elf.c

index 055c9a0e183e8c8eaf2ee48c71cdd5e24de6cac5..cea19a8ad438ccc9f6fa86af60d8d710e3c0a5cf 100644 (file)
@@ -1054,22 +1054,14 @@ static int dump_seek(struct file *file, off_t off)
  */
 static int maydump(struct vm_area_struct *vma)
 {
-       /*
-        * 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))
+       /* Do not dump I/O mapped devices, shared memory, or special mappings */
+       if (vma->vm_flags & (VM_IO | VM_SHARED | VM_RESERVED))
                return 0;
 
-       /* Do not dump I/O mapped devices! -DaveM */
-       if (vma->vm_flags & VM_IO)
-               return 0;
-#if 1
-       if (vma->vm_flags & (VM_WRITE|VM_GROWSUP|VM_GROWSDOWN))
-               return 1;
-       if (vma->vm_flags & (VM_READ|VM_EXEC|VM_EXECUTABLE|VM_SHARED))
+       /* If it hasn't been written to, don't write it out */
+       if (!vma->anon_vma)
                return 0;
-#endif
+
        return 1;
 }