[T,X,A] UBUNTU: SAUCE: remove ibrs_dump sysctl interface

Message ID 1522863528-1348-1-git-send-email-kamal@canonical.com
State New
Headers show
Series
  • [T,X,A] UBUNTU: SAUCE: remove ibrs_dump sysctl interface
Related show

Commit Message

Kamal Mostafa April 4, 2018, 5:38 p.m.
BugLink: http://bugs.launchpad.net/bugs/1755627

The ibrs_dump sysctl interface landed in the Ubuntu backport
df043b74ba71 ("x86/spec_ctrl: Add sysctl knobs to enable/disable
SPEC_CTRL feature") but nothing like it reached mainline.

This debug interface spams dmesg with many lines of output each time
/proc/sys/kernel/ibrs_dump is accessed (notably, every run of 'sysctl -a')
The interface returns only a dummy sysctl value; it has no other purpose
aside from generating dmesg output.

Remove the interface to squelch the excessive dmesg logging by 'sysctl -a'.

Fixes: df043b74ba71 ("x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature")
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/sysctl.c | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

Comments

Colin King April 4, 2018, 5:45 p.m. | #1
On 04/04/18 18:38, Kamal Mostafa wrote:
> BugLink: http://bugs.launchpad.net/bugs/1755627
> 
> The ibrs_dump sysctl interface landed in the Ubuntu backport
> df043b74ba71 ("x86/spec_ctrl: Add sysctl knobs to enable/disable
> SPEC_CTRL feature") but nothing like it reached mainline.
> 
> This debug interface spams dmesg with many lines of output each time
> /proc/sys/kernel/ibrs_dump is accessed (notably, every run of 'sysctl -a')
> The interface returns only a dummy sysctl value; it has no other purpose
> aside from generating dmesg output.
> 
> Remove the interface to squelch the excessive dmesg logging by 'sysctl -a'.
> 
> Fixes: df043b74ba71 ("x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature")
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  kernel/sysctl.c | 40 ----------------------------------------
>  1 file changed, 40 deletions(-)
> 
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 8a236ed..c642775 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -205,8 +205,6 @@ int proc_dointvec_ibrs_ctrl(struct ctl_table *table, int write,
>                   void __user *buffer, size_t *lenp, loff_t *ppos);
>  int proc_dointvec_ibpb_ctrl(struct ctl_table *table, int write,
>                   void __user *buffer, size_t *lenp, loff_t *ppos);
> -int proc_dointvec_ibrs_dump(struct ctl_table *table, int write,
> -                 void __user *buffer, size_t *lenp, loff_t *ppos);
>  #endif
>  
>  #ifdef CONFIG_MAGIC_SYSRQ
> @@ -245,7 +243,6 @@ extern struct ctl_table epoll_table[];
>  int sysctl_legacy_va_layout;
>  #endif
>  
> -u32 sysctl_ibrs_dump = 0;
>  u32 sysctl_ibrs_enabled = 0;
>  EXPORT_SYMBOL(sysctl_ibrs_enabled);
>  u32 sysctl_ibpb_enabled = 0;
> @@ -1254,15 +1251,6 @@ static struct ctl_table kern_table[] = {
>  		.extra1         = &zero,
>  		.extra2         = &one,
>  	},
> -	{
> -		.procname       = "ibrs_dump",
> -		.data           = &sysctl_ibrs_dump,
> -		.maxlen         = sizeof(unsigned int),
> -		.mode           = 0644,
> -		.proc_handler   = proc_dointvec_ibrs_dump,
> -		.extra1         = &zero,
> -		.extra2         = &one,
> -	},
>  #endif
>  	{ }
>  };
> @@ -2422,34 +2410,6 @@ int proc_dointvec_minmax(struct ctl_table *table, int write,
>  }
>  
>  #ifdef CONFIG_X86
> -int proc_dointvec_ibrs_dump(struct ctl_table *table, int write,
> -	void __user *buffer, size_t *lenp, loff_t *ppos)
> -{
> -	int ret, orig_inuse;
> -	unsigned int cpu;
> -
> -
> -	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
> -	printk("sysctl_ibrs_enabled = %u, sysctl_ibpb_enabled = %u\n", sysctl_ibrs_enabled, sysctl_ibpb_enabled);
> -	printk("use_ibrs = %d, use_ibpb = %d\n", use_ibrs, use_ibpb);
> -	mutex_lock(&spec_ctrl_mutex);
> -	orig_inuse = use_ibrs;
> -	/* temporary halt to ibrs usage to dump ibrs values */
> -	clear_ibrs_inuse();
> -	for_each_online_cpu(cpu) {
> -	       u64 val;
> -
> -	       if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
> -		       rdmsrl_on_cpu(cpu, MSR_IA32_SPEC_CTRL, &val);
> -	       else
> -		       val = 0;
> -	       printk("read cpu %d ibrs val %lu\n", cpu, (unsigned long) val);
> -	}
> -	use_ibrs = orig_inuse;
> -	mutex_unlock(&spec_ctrl_mutex);
> -	return ret;
> -}
> -
>  int proc_dointvec_ibrs_ctrl(struct ctl_table *table, int write,
>  	void __user *buffer, size_t *lenp, loff_t *ppos)
>  {
> 
I'm all for reducing spammy noise. Thanks Kamal

Acked-by: Colin Ian King <colin.king@canonical.com>
Kamal Mostafa April 12, 2018, 5:14 p.m. | #2
Applied to [T, X, A].

On Wed, Apr 04, 2018 at 10:38:48AM -0700, Kamal Mostafa wrote:
> BugLink: http://bugs.launchpad.net/bugs/1755627
> 
> The ibrs_dump sysctl interface landed in the Ubuntu backport
> df043b74ba71 ("x86/spec_ctrl: Add sysctl knobs to enable/disable
> SPEC_CTRL feature") but nothing like it reached mainline.
> 
> This debug interface spams dmesg with many lines of output each time
> /proc/sys/kernel/ibrs_dump is accessed (notably, every run of 'sysctl -a')
> The interface returns only a dummy sysctl value; it has no other purpose
> aside from generating dmesg output.
> 
> Remove the interface to squelch the excessive dmesg logging by 'sysctl -a'.
> 
> Fixes: df043b74ba71 ("x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature")
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  kernel/sysctl.c | 40 ----------------------------------------
>  1 file changed, 40 deletions(-)
> 
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 8a236ed..c642775 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -205,8 +205,6 @@ int proc_dointvec_ibrs_ctrl(struct ctl_table *table, int write,
>                   void __user *buffer, size_t *lenp, loff_t *ppos);
>  int proc_dointvec_ibpb_ctrl(struct ctl_table *table, int write,
>                   void __user *buffer, size_t *lenp, loff_t *ppos);
> -int proc_dointvec_ibrs_dump(struct ctl_table *table, int write,
> -                 void __user *buffer, size_t *lenp, loff_t *ppos);
>  #endif
>  
>  #ifdef CONFIG_MAGIC_SYSRQ
> @@ -245,7 +243,6 @@ extern struct ctl_table epoll_table[];
>  int sysctl_legacy_va_layout;
>  #endif
>  
> -u32 sysctl_ibrs_dump = 0;
>  u32 sysctl_ibrs_enabled = 0;
>  EXPORT_SYMBOL(sysctl_ibrs_enabled);
>  u32 sysctl_ibpb_enabled = 0;
> @@ -1254,15 +1251,6 @@ static struct ctl_table kern_table[] = {
>  		.extra1         = &zero,
>  		.extra2         = &one,
>  	},
> -	{
> -		.procname       = "ibrs_dump",
> -		.data           = &sysctl_ibrs_dump,
> -		.maxlen         = sizeof(unsigned int),
> -		.mode           = 0644,
> -		.proc_handler   = proc_dointvec_ibrs_dump,
> -		.extra1         = &zero,
> -		.extra2         = &one,
> -	},
>  #endif
>  	{ }
>  };
> @@ -2422,34 +2410,6 @@ int proc_dointvec_minmax(struct ctl_table *table, int write,
>  }
>  
>  #ifdef CONFIG_X86
> -int proc_dointvec_ibrs_dump(struct ctl_table *table, int write,
> -	void __user *buffer, size_t *lenp, loff_t *ppos)
> -{
> -	int ret, orig_inuse;
> -	unsigned int cpu;
> -
> -
> -	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
> -	printk("sysctl_ibrs_enabled = %u, sysctl_ibpb_enabled = %u\n", sysctl_ibrs_enabled, sysctl_ibpb_enabled);
> -	printk("use_ibrs = %d, use_ibpb = %d\n", use_ibrs, use_ibpb);
> -	mutex_lock(&spec_ctrl_mutex);
> -	orig_inuse = use_ibrs;
> -	/* temporary halt to ibrs usage to dump ibrs values */
> -	clear_ibrs_inuse();
> -	for_each_online_cpu(cpu) {
> -	       u64 val;
> -
> -	       if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
> -		       rdmsrl_on_cpu(cpu, MSR_IA32_SPEC_CTRL, &val);
> -	       else
> -		       val = 0;
> -	       printk("read cpu %d ibrs val %lu\n", cpu, (unsigned long) val);
> -	}
> -	use_ibrs = orig_inuse;
> -	mutex_unlock(&spec_ctrl_mutex);
> -	return ret;
> -}
> -
>  int proc_dointvec_ibrs_ctrl(struct ctl_table *table, int write,
>  	void __user *buffer, size_t *lenp, loff_t *ppos)
>  {
> -- 
> 2.7.4
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Patch

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8a236ed..c642775 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -205,8 +205,6 @@  int proc_dointvec_ibrs_ctrl(struct ctl_table *table, int write,
                  void __user *buffer, size_t *lenp, loff_t *ppos);
 int proc_dointvec_ibpb_ctrl(struct ctl_table *table, int write,
                  void __user *buffer, size_t *lenp, loff_t *ppos);
-int proc_dointvec_ibrs_dump(struct ctl_table *table, int write,
-                 void __user *buffer, size_t *lenp, loff_t *ppos);
 #endif
 
 #ifdef CONFIG_MAGIC_SYSRQ
@@ -245,7 +243,6 @@  extern struct ctl_table epoll_table[];
 int sysctl_legacy_va_layout;
 #endif
 
-u32 sysctl_ibrs_dump = 0;
 u32 sysctl_ibrs_enabled = 0;
 EXPORT_SYMBOL(sysctl_ibrs_enabled);
 u32 sysctl_ibpb_enabled = 0;
@@ -1254,15 +1251,6 @@  static struct ctl_table kern_table[] = {
 		.extra1         = &zero,
 		.extra2         = &one,
 	},
-	{
-		.procname       = "ibrs_dump",
-		.data           = &sysctl_ibrs_dump,
-		.maxlen         = sizeof(unsigned int),
-		.mode           = 0644,
-		.proc_handler   = proc_dointvec_ibrs_dump,
-		.extra1         = &zero,
-		.extra2         = &one,
-	},
 #endif
 	{ }
 };
@@ -2422,34 +2410,6 @@  int proc_dointvec_minmax(struct ctl_table *table, int write,
 }
 
 #ifdef CONFIG_X86
-int proc_dointvec_ibrs_dump(struct ctl_table *table, int write,
-	void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-	int ret, orig_inuse;
-	unsigned int cpu;
-
-
-	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
-	printk("sysctl_ibrs_enabled = %u, sysctl_ibpb_enabled = %u\n", sysctl_ibrs_enabled, sysctl_ibpb_enabled);
-	printk("use_ibrs = %d, use_ibpb = %d\n", use_ibrs, use_ibpb);
-	mutex_lock(&spec_ctrl_mutex);
-	orig_inuse = use_ibrs;
-	/* temporary halt to ibrs usage to dump ibrs values */
-	clear_ibrs_inuse();
-	for_each_online_cpu(cpu) {
-	       u64 val;
-
-	       if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
-		       rdmsrl_on_cpu(cpu, MSR_IA32_SPEC_CTRL, &val);
-	       else
-		       val = 0;
-	       printk("read cpu %d ibrs val %lu\n", cpu, (unsigned long) val);
-	}
-	use_ibrs = orig_inuse;
-	mutex_unlock(&spec_ctrl_mutex);
-	return ret;
-}
-
 int proc_dointvec_ibrs_ctrl(struct ctl_table *table, int write,
 	void __user *buffer, size_t *lenp, loff_t *ppos)
 {