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: <CAPhsuW7xqRa+_sh24b1EWQqzXKwYA+xrcdooMZ3SPefVZjvr1w@mail.gmail.com>
Date:   Wed, 24 Oct 2018 10:56:12 -0700
From:   Song Liu <liu.song.a23@...il.com>
To:     ap420073@...il.com
Cc:     Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Networking <netdev@...r.kernel.org>,
        John Fastabend <john.fastabend@...il.com>
Subject: Re: [PATCH v2 bpf] bpf: devmap: fix wrong interface selection in notifier_call

On Wed, Oct 24, 2018 at 4:16 AM Taehee Yoo <ap420073@...il.com> wrote:
>
> The dev_map_notification() removes interface in devmap if
> unregistering interface's ifindex is same.
> But only checking ifindex is not enough because other netns can have
> same ifindex. so that wrong interface selection could occurred.
> Hence netdev pointer comparison code is added.
>
> v2: compare netdev pointer instead of using net_eq() (Daniel Borkmann)
> v1: Initial patch
>
> Fixes: 2ddf71e23cc2 ("net: add notifier hooks for devmap bpf map")
> Signed-off-by: Taehee Yoo <ap420073@...il.com>
Acked-by: Song Liu <songliubraving@...com>

> ---
>  kernel/bpf/devmap.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index 141710b82a6c..191b79948424 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -512,8 +512,7 @@ static int dev_map_notification(struct notifier_block *notifier,
>                                 struct bpf_dtab_netdev *dev, *odev;
>
>                                 dev = READ_ONCE(dtab->netdev_map[i]);
> -                               if (!dev ||
> -                                   dev->dev->ifindex != netdev->ifindex)
> +                               if (!dev || netdev != dev->dev)
>                                         continue;
>                                 odev = cmpxchg(&dtab->netdev_map[i], dev, NULL);
>                                 if (dev == odev)
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ