Skip to contentSkip to conversation

fixes for work.sysctl

PATCH New Christoph Hellwig 2 participants 7 messages Jun 3, 2020 – Jun 8, 2020

Subsystems (5)
Networking VFS Tracing ftrace +1 more subsystems
lore
Share & tools
lore
#0 lore raw

Hi Al,

a bunch of fixes for the sysctl kernel pointer conversion against your work.sysctl branch. Only the first one is a real behavior fix, the rest just removes left over __user annotations.

#1 lore raw

PATCH 1/4 net/sysctl: use cpumask_parse in flow_limit_cpu_sysctl

cpumask_parse_user works on __user pointers, so this is wrong now.

Fixes 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
---
 net/core/sysctl_net_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/sysctl_net_core.c +1 -1
index 0ddb13a6282b0..d14d049af52ae 100644
@@ -126,7 +126,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
 		return -ENOMEM;
 
 	if (write) {
-		ret = cpumask_parse_user(buffer, *lenp, mask);
+		ret = cpumask_parse(buffer, mask);
 		if (ret)
 			goto done;
 
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/4 net/sysctl: remove leftover __user annotations on neigh_proc_dointvec*

In reply to Christoph Hellwig

Remove the leftover __user annotation on the prototypes for neigh_proc_dointvec*. The implementations already got this right, but the headers kept the __user tags around.

Fixes 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
---
 include/net/neighbour.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
include/net/neighbour.h +3 -4
index e1476775769c9..81ee17594c329 100644
@@ -392,13 +392,12 @@ void *neigh_seq_next(struct seq_file *, void *, loff_t *);
 void neigh_seq_stop(struct seq_file *, void *);
 
 int neigh_proc_dointvec(struct ctl_table *ctl, int write,
-			void __user *buffer, size_t *lenp, loff_t *ppos);
+			void *buffer, size_t *lenp, loff_t *ppos);
 int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write,
-				void __user *buffer,
+				void *buffer,
 				size_t *lenp, loff_t *ppos);
 int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write,
-				   void __user *buffer,
-				   size_t *lenp, loff_t *ppos);
+				   void *buffer, size_t *lenp, loff_t *ppos);
 
 int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
 			  proc_handler *proc_handler);
Signature · 1 line
2.26.2
#3 lore raw

PATCH 3/4 random: fix an incorrect __user annotation on proc_do_entropy

In reply to Christoph Hellwig

No user pointers for sysctls anymore.

Fixes 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
---
 drivers/char/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/random.c +1 -1
index 1e0db78b83baa..cf8a43f5eb2a0 100644
@@ -2087,7 +2087,7 @@ static int proc_do_uuid(struct ctl_table *table, int write,
  * Return entropy available scaled to integral bits
  */
 static int proc_do_entropy(struct ctl_table *table, int write,
-			   void __user *buffer, size_t *lenp, loff_t *ppos)
+			   void *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct ctl_table fake_table;
 	int entropy_count;
Signature · 1 line
2.26.2
#4 lore raw

PATCH 4/4 trace: fix an incorrect __user annotation on stack_trace_sysctl

In reply to Christoph Hellwig

No user pointers for sysctls anymore.

Fixes 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
---
 include/linux/ftrace.h     | 5 ++---
 kernel/trace/trace_stack.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
include/linux/ftrace.h +2 -3
index ddfc377de0d2c..fce81238f304d 100644
@@ -319,9 +319,8 @@ static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs,
 
 extern int stack_tracer_enabled;
 
-int stack_trace_sysctl(struct ctl_table *table, int write,
-		       void __user *buffer, size_t *lenp,
-		       loff_t *ppos);
+int stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,
+		       size_t *lenp, loff_t *ppos);
 
 /* DO NOT MODIFY THIS VARIABLE DIRECTLY! */
 DECLARE_PER_CPU(int, disable_stack_tracer);
kernel/trace/trace_stack.c +2 -3
index c557f42a93971..98bba4764c527 100644
@@ -515,9 +515,8 @@ static const struct file_operations stack_trace_filter_fops = {
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 int
-stack_trace_sysctl(struct ctl_table *table, int write,
-		   void __user *buffer, size_t *lenp,
-		   loff_t *ppos)
+stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,
+		   size_t *lenp, loff_t *ppos)
 {
 	int was_enabled;
 	int ret;
Signature · 1 line
2.26.2
#5 lore raw
In reply to Christoph Hellwig

ping? Can you pick these up now that the original patches are in Linus' tree?

Quoted 5 lines · Christoph Hellwig

Hi Al,

a bunch of fixes for the sysctl kernel pointer conversion against your work.sysctl branch. Only the first one is a real behavior fix, the rest just removes left over __user annotations.

---end quoted text---

maintainer
#6 lore raw
Quoted 2 lines · Christoph Hellwig

ping? Can you pick these up now that the original patches are in Linus' tree?

Applied and pushed; will send pull request later today.