[PATCH 2/4] coredump: ELF: enable to omit anonymous shared memory

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kawai, Hidehiro
Date: Thursday, March 1, 2007 - 9:49 pm

This patch enables to omit anonymous shared memory from an ELF
formatted core file when it is generated.

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
---
 fs/binfmt_elf.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Index: linux-2.6.20-mm2/fs/binfmt_elf.c
===================================================================
--- linux-2.6.20-mm2.orig/fs/binfmt_elf.c
+++ linux-2.6.20-mm2/fs/binfmt_elf.c
@@ -1191,9 +1191,15 @@ static int maydump(struct vm_area_struct
 	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_path.dentry->d_inode->i_nlink == 0;
+	/*
+	 * Dump shared memory only if mapped from an anonymous file and
+	 * /proc/<pid>/coredump_omit_anonymous_shared flag is not set.
+	 */
+	if (vma->vm_flags & VM_SHARED) {
+		if (vma->vm_file->f_path.dentry->d_inode->i_nlink)
+			return 0;
+		return vma->vm_mm->coredump_omit_anon_shared == 0;
+	}
 
 	/* If it hasn't been written to, don't write it out */
 	if (!vma->anon_vma)


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/4] coredump: core dump masking support v4, Kawai, Hidehiro, (Thu Mar 1, 9:41 pm)
[PATCH 2/4] coredump: ELF: enable to omit anonymous shared ..., Kawai, Hidehiro, (Thu Mar 1, 9:49 pm)
[PATCH 4/4] coredump: documentation for proc entry, Kawai, Hidehiro, (Thu Mar 1, 9:51 pm)
Re: [PATCH 4/4] coredump: documentation for proc entry, Pavel Machek, (Fri Mar 2, 2:35 am)
Re: [PATCH 0/4] coredump: core dump masking support v4, Andrew Morton, (Thu Mar 15, 1:37 pm)
Re: [PATCH 4/4] coredump: documentation for proc entry, Kawai, Hidehiro, (Tue Mar 20, 4:11 am)
Re: [PATCH 0/4] coredump: core dump masking support v4, Kawai, Hidehiro, (Fri Mar 23, 6:13 am)
Re: [PATCH 0/4] coredump: core dump masking support v4, Kawai, Hidehiro, (Wed Mar 28, 5:37 am)
Re: [PATCH 0/4] coredump: core dump masking support v4, Andrew Morton, (Wed Mar 28, 10:32 am)