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: <CAAej5NZZNg+0EbZsa-SrP0S_sOPMqdzgQ9hS8z6DYpQp9G+yhw@mail.gmail.com>
Date:   Wed, 3 Jun 2020 10:56:55 +0200
From:   Ferenc Fejes <fejes@....elte.hu>
To:     Matthieu Baerts <matthieu.baerts@...sares.net>
Cc:     netdev@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf] bpf: fix unused-var without NETDEVICES

Matthieu Baerts <matthieu.baerts@...sares.net> ezt írta (időpont:
2020. jún. 3., Sze, 10:11):
>
> A recent commit added new variables only used if CONFIG_NETDEVICES is
> set.

Thank you for noticing and fixed this!

> A simple fix is to only declare these variables if the same
> condition is valid.
>
> Other solutions could be to move the code related to SO_BINDTODEVICE
> option from _bpf_setsockopt() function to a dedicated one or only
> declare these variables in the related "case" section.

Yes thats indeed a cleaner way to approach this. I will prepare a fix for that.

>
> Fixes: 70c58997c1e8 ("bpf: Allow SO_BINDTODEVICE opt in bpf_setsockopt")
> Signed-off-by: Matthieu Baerts <matthieu.baerts@...sares.net>
> ---
>
> Notes:
>     This fix currently applies on net-next and bpf-next only. Except that
>     net-next is now closed and -net will get commits from net-next after
>     Linus' pull.
>
>     I hope it is fine to have picked [PATCH bpf] and not bpf-next (or net).
>
>  net/core/filter.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index d01a244b5087..ee08c6fcee1a 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4286,9 +4286,11 @@ static const struct bpf_func_proto bpf_get_socket_uid_proto = {
>  static int _bpf_setsockopt(struct sock *sk, int level, int optname,
>                            char *optval, int optlen, u32 flags)
>  {
> +#ifdef CONFIG_NETDEVICES
>         char devname[IFNAMSIZ];
>         struct net *net;
>         int ifindex;
> +#endif
>         int ret = 0;
>         int val;
>
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ