LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] make sysctl/kernel/core_pattern and fs/exec.c agree on maximum core filename size
@ 2007-05-13 17:31 Dan Aloni
  2007-05-13 20:08 ` Dan Aloni
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Aloni @ 2007-05-13 17:31 UTC (permalink / raw)
  To: Linux Kernel List

Make sysctl/kernel/core_pattern and fs/exec.c agree on maximum 
core filename size and change it to 128, so that extensive patterns 
such as '/local/cores/%e-%h-%s-%t-%p.core' won't result in 
truncated filename generation.


diff --git a/fs/exec.c b/fs/exec.c
index 70fa365..0b68588 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -60,7 +60,7 @@
 #endif
 
 int core_uses_pid;
-char core_pattern[128] = "core";
+char core_pattern[CORENAME_MAX_SIZE] = "core";
 int suid_dumpable = 0;
 
 EXPORT_SYMBOL(suid_dumpable);
@@ -1264,8 +1264,6 @@ int set_binfmt(struct linux_binfmt *new)
 
 EXPORT_SYMBOL(set_binfmt);
 
-#define CORENAME_MAX_SIZE 64
-
 /* format_corename will inspect the pattern parameter, and output a
  * name into corename, which must have space for at least
  * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 2d956cd..e1a7083 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -17,6 +17,8 @@ struct pt_regs;
 
 #ifdef __KERNEL__
 
+#define CORENAME_MAX_SIZE 128
+
 /*
  * This structure is used to hold the arguments that are used when loading binaries.
  */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4073353..30ee462 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -227,7 +227,7 @@ static ctl_table kern_table[] = {
 		.ctl_name	= KERN_CORE_PATTERN,
 		.procname	= "core_pattern",
 		.data		= core_pattern,
-		.maxlen		= 128,
+		.maxlen		= CORENAME_MAX_SIZE,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,


-- 
Dan Aloni
XIV LTD, http://www.xivstorage.com
da-x (at) monatomic.org, dan (at) xiv.co.il

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] make sysctl/kernel/core_pattern and fs/exec.c agree on maximum core filename size
  2007-05-13 17:31 [PATCH] make sysctl/kernel/core_pattern and fs/exec.c agree on maximum core filename size Dan Aloni
@ 2007-05-13 20:08 ` Dan Aloni
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Aloni @ 2007-05-13 20:08 UTC (permalink / raw)
  To: Linux Kernel List

Make sysctl/kernel/core_pattern and fs/exec.c agree on maximum 
core filename size and change it to 128, so that extensive patterns 
such as '/local/cores/%e-%h-%s-%t-%p.core' won't result in 
truncated filename generation.

Signed-off-by: Dan Aloni <da-x@monatomic.org>

diff --git a/fs/exec.c b/fs/exec.c
index 70fa365..0b68588 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -60,7 +60,7 @@
 #endif
 
 int core_uses_pid;
-char core_pattern[128] = "core";
+char core_pattern[CORENAME_MAX_SIZE] = "core";
 int suid_dumpable = 0;
 
 EXPORT_SYMBOL(suid_dumpable);
@@ -1264,8 +1264,6 @@ int set_binfmt(struct linux_binfmt *new)
 
 EXPORT_SYMBOL(set_binfmt);
 
-#define CORENAME_MAX_SIZE 64
-
 /* format_corename will inspect the pattern parameter, and output a
  * name into corename, which must have space for at least
  * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 2d956cd..e1a7083 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -17,6 +17,8 @@ struct pt_regs;
 
 #ifdef __KERNEL__
 
+#define CORENAME_MAX_SIZE 128
+
 /*
  * This structure is used to hold the arguments that are used when loading binaries.
  */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4073353..30ee462 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -227,7 +227,7 @@ static ctl_table kern_table[] = {
 		.ctl_name	= KERN_CORE_PATTERN,
 		.procname	= "core_pattern",
 		.data		= core_pattern,
-		.maxlen		= 128,
+		.maxlen		= CORENAME_MAX_SIZE,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,

-- 
Dan Aloni
XIV LTD, http://www.xivstorage.com
da-x (at) monatomic.org, dan (at) xiv.co.il

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-13 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-13 17:31 [PATCH] make sysctl/kernel/core_pattern and fs/exec.c agree on maximum core filename size Dan Aloni
2007-05-13 20:08 ` Dan Aloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).