Skip to contentSkip to conversation

compat: remove compat_printk

PATCH Applied Arnd Bergmann 3 participants 4 messages Jun 17, 2016 – Jun 22, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: remove compat_printk

After 7e8e385aaf6e ("x86/compat: Remove sys32_vm86_warning"), this function has become unused, so we can remove it as well.

---
 fs/compat.c            | 14 --------------
 include/linux/compat.h |  1 -
 kernel/sysctl.c        | 10 ----------
 3 files changed, 25 deletions(-)
fs/compat.c +0 -14
index be6e48b0a46c..e07968974391 100644
@@ -54,20 +54,6 @@
 #include <asm/ioctls.h>
 #include "internal.h"
 
-int compat_log = 1;
-
-int compat_printk(const char *fmt, ...)
-{
-	va_list ap;
-	int ret;
-	if (!compat_log)
-		return 0;
-	va_start(ap, fmt);
-	ret = vprintk(fmt, ap);
-	va_end(ap);
-	return ret;
-}
-
 /*
  * Not all architectures have sys_utime, so implement this in terms
  * of sys_utimes.
include/linux/compat.h +0 -1
index 0c510f25cf99..5adf66de6e6b 100644
@@ -433,7 +433,6 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
 
 asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
 
-extern __printf(1, 2) int compat_printk(const char *fmt, ...);
 extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat);
 extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set);
 
kernel/sysctl.c +0 -10
index 35f0dcb1cb4f..de331c3858e5 100644
@@ -106,7 +106,6 @@ extern unsigned int core_pipe_limit;
 extern int pid_max;
 extern int pid_max_min, pid_max_max;
 extern int percpu_pagelist_fraction;
-extern int compat_log;
 extern int latencytop_enabled;
 extern int sysctl_nr_open_min, sysctl_nr_open_max;
 #ifndef CONFIG_MMU
@@ -1077,15 +1076,6 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &neg_one,
 	},
 #endif
-#ifdef CONFIG_COMPAT
-	{
-		.procname	= "compat-log",
-		.data		= &compat_log,
-		.maxlen		= sizeof (int),
-	 	.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
 #ifdef CONFIG_RT_MUTEXES
 	{
 		.procname	= "max_lock_depth",
Signature · 1 line
2.9.0
#1 lore raw
Quoted 2 lines · On Fri, 17 Jun 2016 16:26:21 +0200 Arnd Bergmann <[email protected]> wrote:

After 7e8e385aaf6e ("x86/compat: Remove sys32_vm86_warning"), this function has become unused, so we can remove it as well.

hm,

kernel/sysctl.c static struct ctl_table kern_table[] = { · line 1088

Quoted 13 lines
kernel/sysctl.c +0 -9
@@ -1077,15 +1076,6 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &neg_one,
 	},
 #endif
-#ifdef CONFIG_COMPAT
-	{
-		.procname	= "compat-log",
-		.data		= &compat_log,
-		.maxlen		= sizeof (int),
-	 	.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif

How do we know we can simply remove /proc/sys/kernel/compat-log without breaking any userspace?

#2 lore raw
Quoted 8 lines · CEST Andrew Morton
Quoted 8 lines
kernel/sysctl.c +0 -4
@@ -1077,15 +1076,6 @@ static struct ctl_table kern_table[] = {
              .extra1         = &neg_one,
      },
 #endif
-#ifdef CONFIG_COMPAT
-     {
-             .procname       = "compat-log",
-             .data           = &compat_log,
Quoted 9 lines

kernel/sysctl.c static struct ctl_table kern_table[] = { · line 1088

Quoted 5 lines
kernel/sysctl.c +0 -5
-             .maxlen         = sizeof (int),
-             .mode           = 0644,
-             .proc_handler   = proc_dointvec,
-     },
-#endif

How do we know we can simply remove /proc/sys/kernel/compat-log without breaking any userspace?

Good point. I guess we can leave this in place just in case (with a comment) and just remove the compat_printk function. We could probably have a Kconfig symbol for obsolete sysctl files, but if this is the only one controlled by it, it's probably not worth the effort.

Arnd

#3 lore raw
Quoted 22 lines · Arnd Bergmann
Quoted 8 lines · CEST Andrew Morton
Quoted 8 lines
kernel/sysctl.c +0 -4
@@ -1077,15 +1076,6 @@ static struct ctl_table kern_table[] = {
             .extra1         = &neg_one,
     },
 #endif
-#ifdef CONFIG_COMPAT
-     {
-             .procname       = "compat-log",
-             .data           = &compat_log,
Quoted 9 lines

kernel/sysctl.c static struct ctl_table kern_table[] = { · line 1088

Quoted 5 lines
kernel/sysctl.c +0 -5
-             .maxlen         = sizeof (int),
-             .mode           = 0644,
-             .proc_handler   = proc_dointvec,
-     },
-#endif

How do we know we can simply remove /proc/sys/kernel/compat-log without breaking any userspace?

Quoted 4 lines

Good point. I guess we can leave this in place just in case (with a comment) and just remove the compat_printk function. We could probably have a Kconfig symbol for obsolete sysctl files, but if this is the only one controlled by it, it's probably not worth the effort.

It probably makes sense to print a deprecation warning containing the current process name if this /proc file is modified, so that users can update any scripts/tools using it.

Cheers, Andreas