lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1335681937-3715-4-git-send-email-levinsasha928@gmail.com>
Date:	Sun, 29 Apr 2012 08:45:27 +0200
From:	Sasha Levin <levinsasha928@...il.com>
To:	viro@...iv.linux.org.uk, rostedt@...dmis.org, fweisbec@...il.com,
	mingo@...hat.com, a.p.zijlstra@...llo.nl, paulus@...ba.org,
	acme@...stprotocols.net, james.l.morris@...cle.com,
	ebiederm@...ssion.com, akpm@...ux-foundation.org,
	tglx@...utronix.de
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, linux-security-module@...r.kernel.org,
	Sasha Levin <levinsasha928@...il.com>
Subject: [PATCH 04/14] ftrace,sysctl: remove proc input checks out of sysctl handlers

Simplify sysctl handler by removing user input checks and using the callback
provided by the sysctl table.

Signed-off-by: Sasha Levin <levinsasha928@...il.com>
---
 include/linux/ftrace.h     |    8 ++------
 kernel/sysctl.c            |    6 ++++--
 kernel/trace/ftrace.c      |    8 ++------
 kernel/trace/trace_stack.c |    9 ++-------
 4 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 72a6cab..75a3530 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -25,9 +25,7 @@ struct ftrace_hash;
 
 extern int ftrace_enabled;
 extern int
-ftrace_enable_sysctl(struct ctl_table *table, int write,
-		     void __user *buffer, size_t *lenp,
-		     loff_t *ppos);
+ftrace_enable_sysctl(void);
 
 typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
 
@@ -181,9 +179,7 @@ static inline void ftrace_start(void) { }
 #ifdef CONFIG_STACK_TRACER
 extern int stack_tracer_enabled;
 int
-stack_trace_sysctl(struct ctl_table *table, int write,
-		   void __user *buffer, size_t *lenp,
-		   loff_t *ppos);
+stack_trace_sysctl(void);
 #endif
 
 struct ftrace_func_command {
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index fad9ff6..40be238 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -519,7 +519,8 @@ static struct ctl_table kern_table[] = {
 		.data		= &ftrace_enabled,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= ftrace_enable_sysctl,
+		.proc_handler	= proc_dointvec,
+		.callback	= ftrace_enable_sysctl,
 	},
 #endif
 #ifdef CONFIG_STACK_TRACER
@@ -528,7 +529,8 @@ static struct ctl_table kern_table[] = {
 		.data		= &stack_tracer_enabled,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= stack_trace_sysctl,
+		.callback	= stack_trace_sysctl,
+		.proc_handler	= proc_dointvec,
 	},
 #endif
 #ifdef CONFIG_TRACING
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0fa92f6..70a5ec4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4340,9 +4340,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
 EXPORT_SYMBOL_GPL(unregister_ftrace_function);
 
 int
-ftrace_enable_sysctl(struct ctl_table *table, int write,
-		     void __user *buffer, size_t *lenp,
-		     loff_t *ppos)
+ftrace_enable_sysctl(void)
 {
 	int ret = -ENODEV;
 
@@ -4351,9 +4349,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
 	if (unlikely(ftrace_disabled))
 		goto out;
 
-	ret = proc_dointvec(table, write, buffer, lenp, ppos);
-
-	if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled))
+	if (last_ftrace_enabled == !!ftrace_enabled)
 		goto out;
 
 	last_ftrace_enabled = !!ftrace_enabled;
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index d4545f4..3b05ec2 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -329,18 +329,13 @@ static const struct file_operations stack_trace_filter_fops = {
 };
 
 int
-stack_trace_sysctl(struct ctl_table *table, int write,
-		   void __user *buffer, size_t *lenp,
-		   loff_t *ppos)
+stack_trace_sysctl(void)
 {
 	int ret;
 
 	mutex_lock(&stack_sysctl_mutex);
 
-	ret = proc_dointvec(table, write, buffer, lenp, ppos);
-
-	if (ret || !write ||
-	    (last_stack_tracer_enabled == !!stack_tracer_enabled))
+	if (last_stack_tracer_enabled == !!stack_tracer_enabled)
 		goto out;
 
 	last_stack_tracer_enabled = !!stack_tracer_enabled;
-- 
1.7.8.5

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ