From: Roland McGrath We're currently not including sysv shared memory segments in coredumps. This patch intends to include any shared mapping whose target file has zero links. That covers sysv shm and MAP_ANON|MAP_SHARED mmap's (which I think are only ever useful if you want to share pages with a fork'd child). I think it also covers a regular file that was unlinked but is still mmap'd. It doesn't cover mapping of a tmpfs file like /dev/shm/foo, but those are still available to be seen after your program crashes, until reboot. Note that this still omits plenty of cases that the old code would include, such as all writable shared mappings of regular files. It also will include some arcane cases the old one wouldn't, like a read-only shared mapping of an unlinked file; that comes up e.g., for the text segment of a shared library or executable that was removed/renamed-over while still in use. Signed-off-by: Andrew Morton --- 25-akpm/fs/binfmt_elf.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff -puN fs/binfmt_elf.c~unbacked-shared-memory-not-included-in-elf-core-dump fs/binfmt_elf.c --- 25/fs/binfmt_elf.c~unbacked-shared-memory-not-included-in-elf-core-dump 2005-03-09 15:16:29.000000000 -0800 +++ 25-akpm/fs/binfmt_elf.c 2005-03-09 15:16:29.000000000 -0800 @@ -1140,10 +1140,14 @@ static int dump_seek(struct file *file, */ static int maydump(struct vm_area_struct *vma) { - /* Do not dump I/O mapped devices, shared memory, or special mappings */ - if (vma->vm_flags & (VM_IO | VM_SHARED | VM_RESERVED)) + /* Do not dump I/O mapped devices or special mappings */ + if (vma->vm_flags & (VM_IO | VM_RESERVED)) return 0; + /* Dump shared memory only if mapped from an anonymous file. */ + if (vma->vm_flags & VM_SHARED) + return vma->vm_file->f_dentry->d_inode->i_nlink == 0; + /* If it hasn't been written to, don't write it out */ if (!vma->anon_vma) return 0; _