public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, roland@redhat.com,
	kosaki.motohiro@jp.fujitsu.com,
	sugita <yumiko.sugita.yf@hitachi.com>,
	Satoshi OSHIMA <satoshi.oshima.fk@hitachi.com>
Subject: [PATCH] coredump_filter: enable to change the default filter
Date: Thu, 11 Dec 2008 15:33:10 +0900	[thread overview]
Message-ID: <4940B426.6040509@hitachi.com> (raw)

This patch introduces new kernel parameter `coredump_filter'.
Setting a value to this parameter causes the default bitmask
of coredump_filter to be changed.

It is useful for users to change coredump_filter settings for
the whole system at boot time.  Without this parameter, users
have to change coredump_filter settings for each /proc/<pid>/
in an initializing script.

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
CC: Roland McGrath <roland@redhat.com>
CC: Motohiro Kosaki <kosaki.motohiro@jp.fujitsu.com>
---
 Documentation/kernel-parameters.txt |    5 +++++
 kernel/fork.c                       |   15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

Index: linux-2.6.28-rc8/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.28-rc8.orig/Documentation/kernel-parameters.txt
+++ linux-2.6.28-rc8/Documentation/kernel-parameters.txt
@@ -547,6 +547,11 @@ and is between 256 and 4096 characters. 
 			not work reliably with all consoles, but is known
 			to work with serial and VGA consoles.
 
+	coredump_filter=
+			[KNL] Change the default value for
+			/proc/<pid>/coredump_filter.
+			See also Documentation/filesystems/proc.txt.
+
 	cpcihp_generic=	[HW,PCI] Generic port I/O CompactPCI driver
 			Format:
 			<first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
Index: linux-2.6.28-rc8/kernel/fork.c
===================================================================
--- linux-2.6.28-rc8.orig/kernel/fork.c
+++ linux-2.6.28-rc8/kernel/fork.c
@@ -397,6 +397,18 @@ __cacheline_aligned_in_smp DEFINE_SPINLO
 #define allocate_mm()	(kmem_cache_alloc(mm_cachep, GFP_KERNEL))
 #define free_mm(mm)	(kmem_cache_free(mm_cachep, (mm)))
 
+static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT;
+
+static int __init coredump_filter_setup(char *s)
+{
+	default_dump_filter =
+		(simple_strtoul(s, NULL, 0) << MMF_DUMP_FILTER_SHIFT) &
+		MMF_DUMP_FILTER_MASK;
+	return 1;
+}
+
+__setup("coredump_filter=", coredump_filter_setup);
+
 #include <linux/init_task.h>
 
 static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
@@ -405,8 +417,7 @@ static struct mm_struct * mm_init(struct
 	atomic_set(&mm->mm_count, 1);
 	init_rwsem(&mm->mmap_sem);
 	INIT_LIST_HEAD(&mm->mmlist);
-	mm->flags = (current->mm) ? current->mm->flags
-				  : MMF_DUMP_FILTER_DEFAULT;
+	mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
 	mm->core_state = NULL;
 	mm->nr_ptes = 0;
 	set_mm_counter(mm, file_rss, 0);




             reply	other threads:[~2008-12-11  7:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11  6:33 Hidehiro Kawai [this message]
2008-12-11  6:46 ` [PATCH] coredump_filter: enable to change the default filter KOSAKI Motohiro
2008-12-11 23:10   ` Andrew Morton
2008-12-11 23:22     ` Roland McGrath
2008-12-19 10:05       ` Hidehiro Kawai
2008-12-19 19:53         ` Roland McGrath
2008-12-26  6:22           ` Hidehiro Kawai
2008-12-26  6:49             ` KOSAKI Motohiro
2008-12-26  9:45               ` Hidehiro Kawai
2008-12-26 11:46                 ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4940B426.6040509@hitachi.com \
    --to=hidehiro.kawai.ez@hitachi.com \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=satoshi.oshima.fk@hitachi.com \
    --cc=yumiko.sugita.yf@hitachi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox