Re: [PATCH] dump read-only anonymous memory in core files

From: Linus Torvalds
Date: Tue Oct 07 2003 - 04:07:33 EST



What about shared mappings (that test should be VM_MAYSHARE)?

My inclination would be to not dump them if they are backed by a file,
even if the mmap is writable.

Also, the VM_WRITE test should possibly be VM_MAYWRITE, since the thing
could have been mprotect()'ed. Alternatively, we could really add a "this
mapping has been writable" flag (a kind of "sticky VM_WRITE" bit). It's
only mprotect that can do this, anyway.

Ehh?

Which would make the logic be something like

/* Do not dump I/O mapped devices! -DaveM */
if (vma->vm_flags & VM_IO)
return 0;

/* file-backed mapping? */
if (vma->vm_file) {
if (vma->vm_flags & VM_MAYSHARE)
return 0;
if (!(vma->vm_flags & VM_MAYWRITE))
return 0;
}

return 1;

Hmm?

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/