coredump masking: add an interface for core dump filter
This patch adds an interface to set/reset flags which determines each memory segment should be dumped or not when a core file is generated. /proc/<pid>/coredump_filter file is provided to access the flags. You can change the flag status for a particular process by writing to or reading from the file. The flag status is inherited to the child process when it is created. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: David Howells <dhowells@redhat.com> Cc: Hugh Dickins <hugh@veritas.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
6c5d523826
commit
3cb4a0bb1e
@@ -349,8 +349,22 @@ extern void set_dumpable(struct mm_struct *mm, int value);
|
||||
extern int get_dumpable(struct mm_struct *mm);
|
||||
|
||||
/* mm flags */
|
||||
/* dumpable bits */
|
||||
#define MMF_DUMPABLE 0 /* core dump is permitted */
|
||||
#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
|
||||
#define MMF_DUMPABLE_BITS 2
|
||||
|
||||
/* coredump filter bits */
|
||||
#define MMF_DUMP_ANON_PRIVATE 2
|
||||
#define MMF_DUMP_ANON_SHARED 3
|
||||
#define MMF_DUMP_MAPPED_PRIVATE 4
|
||||
#define MMF_DUMP_MAPPED_SHARED 5
|
||||
#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
|
||||
#define MMF_DUMP_FILTER_BITS 4
|
||||
#define MMF_DUMP_FILTER_MASK \
|
||||
(((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
|
||||
#define MMF_DUMP_FILTER_DEFAULT \
|
||||
((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED))
|
||||
|
||||
struct mm_struct {
|
||||
struct vm_area_struct * mmap; /* list of VMAs */
|
||||
|
Reference in New Issue
Block a user