[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091221012025.A2FA2B158A@basil.firstfloor.org>
Date: Mon, 21 Dec 2009 02:20:25 +0100 (CET)
From: Andi Kleen <andi@...stfloor.org>
To: linux-kernel@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
ebiederm@...ssion.com
Subject: [PATCH] [4/11] SYSCTL: Use RCU strings for core_pattern sysctl
As a bonus this removes one use of the BKL.
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
fs/exec.c | 9 ++++-----
kernel/sysctl.c | 6 +++---
2 files changed, 7 insertions(+), 8 deletions(-)
Index: linux-2.6.33-rc1-ak/fs/exec.c
===================================================================
--- linux-2.6.33-rc1-ak.orig/fs/exec.c
+++ linux-2.6.33-rc1-ak/fs/exec.c
@@ -62,7 +62,7 @@
#include "internal.h"
int core_uses_pid;
-char core_pattern[CORENAME_MAX_SIZE] = "core";
+char *core_pattern = "core";
unsigned int core_pipe_limit;
int suid_dumpable = 0;
@@ -1825,12 +1825,11 @@ void do_coredump(long signr, int exit_co
clear_thread_flag(TIF_SIGPENDING);
/*
- * lock_kernel() because format_corename() is controlled by sysctl, which
- * uses lock_kernel()
+ * Protect corename by RCU vs proc_rcu_string()
*/
- lock_kernel();
+ rcu_read_lock();
ispipe = format_corename(corename, signr);
- unlock_kernel();
+ rcu_read_unlock();
if ((!ispipe) && (cprm.limit < binfmt->min_coredump))
goto fail_unlock;
Index: linux-2.6.33-rc1-ak/kernel/sysctl.c
===================================================================
--- linux-2.6.33-rc1-ak.orig/kernel/sysctl.c
+++ linux-2.6.33-rc1-ak/kernel/sysctl.c
@@ -75,7 +75,7 @@ extern int sysctl_oom_dump_tasks;
extern int max_threads;
extern int core_uses_pid;
extern int suid_dumpable;
-extern char core_pattern[];
+extern char *core_pattern;
extern unsigned int core_pipe_limit;
extern int pid_max;
extern int min_free_kbytes;
@@ -399,10 +399,10 @@ static struct ctl_table kern_table[] = {
},
{
.procname = "core_pattern",
- .data = core_pattern,
+ .data = &core_pattern,
.maxlen = CORENAME_MAX_SIZE,
.mode = 0644,
- .proc_handler = proc_dostring,
+ .proc_handler = proc_rcu_string,
},
{
.procname = "core_pipe_limit",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists