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: <20190614234506.n3kuojutoaqxhyox@ast-mbp.dhcp.thefacebook.com>
Date:   Fri, 14 Jun 2019 16:45:07 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        Willem de Bruijn <willemb@...gle.com>,
        Feng Tang <feng.tang@...el.com>,
        Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net 1/4] sysctl: define proc_do_static_key()

On Fri, Jun 14, 2019 at 04:22:18PM -0700, Eric Dumazet wrote:
> Convert proc_dointvec_minmax_bpf_stats() into a more generic
> helper, since we are going to use jump labels more often.
> 
> Note that sysctl_bpf_stats_enabled is removed, since
> it is no longer needed/used.
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---
>  include/linux/bpf.h    |  1 -
>  include/linux/sysctl.h |  3 +++
>  kernel/bpf/core.c      |  1 -
>  kernel/sysctl.c        | 44 ++++++++++++++++++++++--------------------
>  4 files changed, 26 insertions(+), 23 deletions(-)
> 
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 5df8e9e2a3933949af17dda1d77a4daccd5df611..b92ef9f73e42f1bcf0141aa21d0e9c17c5c7f05b 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -600,7 +600,6 @@ void bpf_map_area_free(void *base);
>  void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);
>  
>  extern int sysctl_unprivileged_bpf_disabled;
> -extern int sysctl_bpf_stats_enabled;
>  
>  int bpf_map_new_fd(struct bpf_map *map, int flags);
>  int bpf_prog_new_fd(struct bpf_prog *prog);
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index b769ecfcc3bd41aad6fd339ba824c6bb622ac24d..aadd310769d080f1d45db14b2a72fc8ad36f1196 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -63,6 +63,9 @@ extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
>  				      void __user *, size_t *, loff_t *);
>  extern int proc_do_large_bitmap(struct ctl_table *, int,
>  				void __user *, size_t *, loff_t *);
> +extern int proc_do_static_key(struct ctl_table *table, int write,
> +			      void __user *buffer, size_t *lenp,
> +			      loff_t *ppos);
>  
>  /*
>   * Register a set of sysctl names by calling register_sysctl_table
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 7c473f208a1058de97434a57a2d47e2360ae80a8..080e2bb644ccd761b3d54fbad9b58a881086231e 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -2097,7 +2097,6 @@ int __weak skb_copy_bits(const struct sk_buff *skb, int offset, void *to,
>  
>  DEFINE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
>  EXPORT_SYMBOL(bpf_stats_enabled_key);
> -int sysctl_bpf_stats_enabled __read_mostly;
>  
>  /* All definitions of tracepoints related to BPF. */
>  #define CREATE_TRACE_POINTS
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 7d1008be6173313c807b2abb23f3171ef05cddc8..1beca96fb6252ddc4af07b6292f9dd95c4f53afd 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -230,11 +230,6 @@ static int proc_dostring_coredump(struct ctl_table *table, int write,
>  #endif
>  static int proc_dopipe_max_size(struct ctl_table *table, int write,
>  		void __user *buffer, size_t *lenp, loff_t *ppos);
> -#ifdef CONFIG_BPF_SYSCALL
> -static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
> -					  void __user *buffer, size_t *lenp,
> -					  loff_t *ppos);
> -#endif
>  
>  #ifdef CONFIG_MAGIC_SYSRQ
>  /* Note: sysrq code uses its own private copy */
> @@ -1253,12 +1248,10 @@ static struct ctl_table kern_table[] = {
>  	},
>  	{
>  		.procname	= "bpf_stats_enabled",
> -		.data		= &sysctl_bpf_stats_enabled,
> -		.maxlen		= sizeof(sysctl_bpf_stats_enabled),
> +		.data		= &bpf_stats_enabled_key.key,
> +		.maxlen		= sizeof(bpf_stats_enabled_key),

maxlen is ignored by proc_do_static_key(), right?

Great idea, btw. I like the series.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ