Re: mmap'ed memory in core files ?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Michael Kerrisk <mtk.manpages@...>
Cc: Philippe De Muyter <phdm@...>, Michael Kerrisk <mtk.manpages@...>, <linux-kernel@...>, <libdc1394-devel@...>, <stefanr@...>, sugita <yumiko.sugita.yf@...>, Satoshi OSHIMA <satoshi.oshima.fk@...>
Date: Wednesday, July 2, 2008 - 11:51 pm

Hi,

Michael Kerrisk wrote:


MMIO pages have been not dumped since a long time ago, and I didn't target
them for the coredump_filter feature because I thought it was generally
danger to read MMIO pages.  As for frame buffer we would be able to
safely access to it, but there is no way to tell it from other MMIO
mappings, AFAIK.


The following patch may help.  To dump MMIO pages, set bit 5 of
coredump_filter.

$ echo 0x23 > /proc/<PID>/coredump_filter


Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
---
This patch is not intended to be merged to the upstream kernel
because the safeness of reading VM_IO mappings has not been
proved.

Index: linux-2.6.26-rc5-mm3/fs/binfmt_elf.c
===================================================================
--- linux-2.6.26-rc5-mm3.orig/fs/binfmt_elf.c
+++ linux-2.6.26-rc5-mm3/fs/binfmt_elf.c
@@ -1141,11 +1141,18 @@ static unsigned long vma_dump_size(struc
 	if (vma->vm_flags & VM_ALWAYSDUMP)
 		goto whole;
 
-	/* Do not dump I/O mapped devices or special mappings */
-	if (vma->vm_flags & (VM_IO | VM_RESERVED))
+#define FILTER(type)	(mm_flags & (1UL << MMF_DUMP_##type))
+
+	/* By default, do not dump memory mapped I/O mappings */
+	if (vma->vm_flags & VM_IO) {
+		if (FILTER(MMIO))
+			goto whole;
 		return 0;
+	}
 
-#define FILTER(type)	(mm_flags & (1UL << MMF_DUMP_##type))
+	/* Do not dump special mappings */
+	if (vma->vm_flags & VM_RESERVED)
+		return 0;
 
 	/* By default, dump shared memory if mapped from an anonymous file. */
 	if (vma->vm_flags & VM_SHARED) {
Index: linux-2.6.26-rc5-mm3/include/linux/sched.h
===================================================================
--- linux-2.6.26-rc5-mm3.orig/include/linux/sched.h
+++ linux-2.6.26-rc5-mm3/include/linux/sched.h
@@ -403,8 +403,9 @@ extern int get_dumpable(struct mm_struct
 #define MMF_DUMP_MAPPED_PRIVATE	4
 #define MMF_DUMP_MAPPED_SHARED	5
 #define MMF_DUMP_ELF_HEADERS	6
+#define MMF_DUMP_MMIO		7
 #define MMF_DUMP_FILTER_SHIFT	MMF_DUMPABLE_BITS
-#define MMF_DUMP_FILTER_BITS	5
+#define MMF_DUMP_FILTER_BITS	6
 #define MMF_DUMP_FILTER_MASK \
 	(((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
 #define MMF_DUMP_FILTER_DEFAULT \



Regards,
-- 
Hidehiro Kawai
Hitachi, Systems Development Laboratory
Linux Technology Center

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

Messages in current thread:
mmap'ed memory in core files ?, Philippe De Muyter, (Tue Jul 1, 9:21 am)
Re: mmap'ed memory in core files ?, Michael Kerrisk, (Tue Jul 1, 2:16 pm)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Wed Jul 2, 7:01 am)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Wed Jul 2, 6:50 am)
Re: mmap'ed memory in core files ?, Christoph Hellwig, (Wed Jul 2, 9:30 am)
Re: mmap'ed memory in core files ?, Michael Kerrisk, (Wed Jul 2, 6:58 am)
Re: mmap'ed memory in core files ?, Hidehiro Kawai, (Wed Jul 2, 11:51 pm)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Thu Jul 3, 5:37 am)
[PATCH] ieee1394 : dump mmapped video1394 buffers in core fi..., Philippe De Muyter, (Thu Jul 3, 12:52 pm)
Re: [PATCH] ieee1394 : dump mmapped video1394 buffers in cor..., Philippe De Muyter, (Fri Jul 4, 4:49 pm)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Thu Jul 3, 5:22 am)
Re: mmap'ed memory in core files ?, Hidehiro Kawai, (Fri Jul 4, 1:50 am)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Fri Jul 4, 7:13 am)
Re: mmap'ed memory in core files ?, Stefan Richter, (Fri Jul 4, 2:33 am)
Re: mmap'ed memory in core files ?, Hugh Dickins, (Fri Jul 4, 10:29 am)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Fri Jul 4, 7:25 am)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Wed Jul 2, 7:04 am)
Re: mmap'ed memory in core files ?, Stefan Richter, (Wed Jul 2, 8:24 am)
Re: mmap'ed memory in core files ?, Philippe De Muyter, (Wed Jul 2, 9:16 am)
Re: mmap'ed memory in core files ?, Bron Gondwana, (Tue Jul 1, 5:44 pm)
Re: mmap'ed memory in core files ?, Michael Kerrisk, (Wed Jul 2, 1:14 am)