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: <CA+HUmGhw7QeqSWSD5Z43Cg=5iJaM01=8BcJCfQ=e_LwOPcG+7Q@mail.gmail.com>
Date:   Wed, 8 Nov 2017 08:29:56 -0800
From:   Francesco Ruggeri <fruggeri@...sta.com>
To:     yoshfuji@...ux-ipv6.org, kuznet@....inr.ac.ru,
        David Miller <davem@...emloft.net>,
        Francesco Ruggeri <fruggeri@...sta.com>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] ipv6: try not to take rtnl_lock in ip6mr_sk_done

Any comments about this?
The idea is to avoid traversing all mr6_tables (which requires
the rtnl_lock) in ip6mr_sk_done(), when we know in advance
that a match will not be found.
This can happen when rawv6_close()/ip6mr_sk_done() is invoked
on non-mroute6 sockets.

Thanks,
Francesco

On Mon, Nov 6, 2017 at 12:40 PM, Francesco Ruggeri <fruggeri@...sta.com> wrote:
> commit 9634257773c30ce13d74fa4918329612c60d84a8
> Author: Francesco Ruggeri <fruggeri@...sta.com>
> Date:   Mon Nov 6 11:01:59 2017 -0800
>
>     ipv6: try not to take rtnl_lock in ip6mr_sk_done
>
>     mrt->mroute6_sk can only be set to a non-NULL value in ip6mr_sk_init()
>     if sk->sk_type == SOCK_RAW && inet_sk(sk)->inet_num == IPPROTO_ICMPV6.
>     Use that not to unnecessarily take the rtn_lock in ip6mr_sk_done()
>     when it is invoked from rawv6_close().
>
> Signed-off-by: Francesco Ruggeri <fruggeri@...sta.com>
>
> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
> index f5500f5..e1bb2d8 100644
> --- a/net/ipv6/ip6mr.c
> +++ b/net/ipv6/ip6mr.c
> @@ -1617,6 +1617,10 @@ int ip6mr_sk_done(struct sock *sk)
>         struct net *net = sock_net(sk);
>         struct mr6_table *mrt;
>
> +       if (sk->sk_type != SOCK_RAW ||
> +           inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
> +               return err;
> +
>         rtnl_lock();
>         ip6mr_for_each_table(mrt, net) {
>                 if (sk == mrt->mroute6_sk) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ