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-next>] [day] [month] [year] [list]
Date:	Tue, 10 Feb 2015 17:51:14 -0800
From:	Alexei Starovoitov <ast@...mgrid.com>
To:	Daniel Borkmann <daniel@...earbox.net>
Cc:	Jiří Pírko <jiri@...nulli.us>,
	Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 6/7] ebpf: remove CONFIG_BPF_SYSCALL ifdefs in
 socket filter code

On Tue, Feb 10, 2015 at 4:15 PM, Daniel Borkmann <daniel@...earbox.net> wrote:
> Socket filter code and other subsystems with upcoming eBPF support
> should not need to deal with the fact that we have CONFIG_BPF_SYSCALL
> defined or not. Having the bpf syscall as a config option is a nice
> thing and I'd expect it to stay that way for expert users (I presume
> one day the default setting of it might change, though), but code
> making use of it should not care if it's actually enabled or not.
> Instead, hide this via header files and let the rest deal with it.
>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> ---
>  include/linux/bpf.h |  27 +++++++--
>  net/core/filter.c   | 166 ++++++++++++++++++++++++----------------------------
>  2 files changed, 100 insertions(+), 93 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 4fe1bd3..def0103 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -114,9 +114,6 @@ struct bpf_prog_type_list {
>         enum bpf_prog_type type;
>  };
>
> -int bpf_register_prog_type(struct bpf_prog_type_list *tl);
> -void bpf_unregister_prog_type(struct bpf_prog_type_list *tl);
> -
>  struct bpf_prog;
>
>  struct bpf_prog_aux {
> @@ -130,11 +127,31 @@ struct bpf_prog_aux {
>  };
>
>  #ifdef CONFIG_BPF_SYSCALL
> +int bpf_register_prog_type(struct bpf_prog_type_list *tl);
> +void bpf_unregister_prog_type(struct bpf_prog_type_list *tl);
> +
>  void bpf_prog_put(struct bpf_prog *prog);
> +struct bpf_prog *bpf_prog_get(u32 ufd);
>  #else
> -static inline void bpf_prog_put(struct bpf_prog *prog) {}
> +static inline int bpf_register_prog_type(struct bpf_prog_type_list *tl)
> +{
> +       return 0;
> +}
> +
> +static inline void bpf_unregister_prog_type(struct bpf_prog_type_list *tl)
> +{
> +}
> +
> +static inline struct bpf_prog *bpf_prog_get(u32 ufd)
> +{
> +       return ERR_PTR(-EOPNOTSUPP);
> +}
> +
> +static inline void bpf_prog_put(struct bpf_prog *prog)
> +{
> +}
>  #endif
> -struct bpf_prog *bpf_prog_get(u32 ufd);

makes sense. I have similar change for bpf+tracing.

> -#ifdef CONFIG_BPF_SYSCALL
> -int sk_attach_bpf(u32 ufd, struct sock *sk)
> -{
> -       struct sk_filter *fp, *old_fp;
> -       struct bpf_prog *prog;

why move the functions inside filter.c ?
couldn't we just remove two lines with #ifdef/endif ?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ