Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1600203
| From | Dmitry Vyukov <dvyukov@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex |
| Date | 2017-03-14 11:40 +0100 |
| Message-ID | <tkS1Y-7a1-11@gated-at.bofh.it> (permalink) |
| References | <thFXj-24E-5@gated-at.bofh.it> <tkQMx-6nu-9@gated-at.bofh.it> <tkRfA-6BP-3@gated-at.bofh.it> <tkRSi-74u-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Mar 14, 2017 at 11:25 AM, Herbert Xu
<herbert@gondor.apana.org.au> wrote:
> On Tue, Mar 14, 2017 at 10:44:10AM +0100, Dmitry Vyukov wrote:
>>
>> Yes, please.
>> Disregarding some reports is not a good way long term.
>
> Please try this patch.
Applied on bots. I should have a conclusion within a day.
Thanks!
> ---8<---
> Subject: netlink: Annotate nlk cb_mutex by protocol
>
> Currently all occurences of nlk->cb_mutex are annotated by lockdep
> as a single class. This causes a false lcokdep cycle involving
> genl and crypto_user.
>
> This patch fixes it by dividing cb_mutex into individual classes
> based on the netlink protocol. As genl and crypto_user do not
> use the same netlink protocol this breaks the false dependency
> loop.
>
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 7b73c7c..596eaff 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -96,6 +96,44 @@ static inline int netlink_is_kernel(struct sock *sk)
>
> static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait);
>
> +static struct lock_class_key nlk_cb_mutex_keys[MAX_LINKS];
> +
> +static const char *const nlk_cb_mutex_key_strings[MAX_LINKS + 1] = {
> + "nlk_cb_mutex-ROUTE",
> + "nlk_cb_mutex-1",
> + "nlk_cb_mutex-USERSOCK",
> + "nlk_cb_mutex-FIREWALL",
> + "nlk_cb_mutex-SOCK_DIAG",
> + "nlk_cb_mutex-NFLOG",
> + "nlk_cb_mutex-XFRM",
> + "nlk_cb_mutex-SELINUX",
> + "nlk_cb_mutex-ISCSI",
> + "nlk_cb_mutex-AUDIT",
> + "nlk_cb_mutex-FIB_LOOKUP",
> + "nlk_cb_mutex-CONNECTOR",
> + "nlk_cb_mutex-NETFILTER",
> + "nlk_cb_mutex-IP6_FW",
> + "nlk_cb_mutex-DNRTMSG",
> + "nlk_cb_mutex-KOBJECT_UEVENT",
> + "nlk_cb_mutex-GENERIC",
> + "nlk_cb_mutex-17",
> + "nlk_cb_mutex-SCSITRANSPORT",
> + "nlk_cb_mutex-ECRYPTFS",
> + "nlk_cb_mutex-RDMA",
> + "nlk_cb_mutex-CRYPTO",
> + "nlk_cb_mutex-SMC",
> + "nlk_cb_mutex-23",
> + "nlk_cb_mutex-24",
> + "nlk_cb_mutex-25",
> + "nlk_cb_mutex-26",
> + "nlk_cb_mutex-27",
> + "nlk_cb_mutex-28",
> + "nlk_cb_mutex-29",
> + "nlk_cb_mutex-30",
> + "nlk_cb_mutex-31",
> + "nlk_cb_mutex-MAX_LINKS"
> +};
> +
> static int netlink_dump(struct sock *sk);
> static void netlink_skb_destructor(struct sk_buff *skb);
>
> @@ -585,6 +623,9 @@ static int __netlink_create(struct net *net, struct socket *sock,
> } else {
> nlk->cb_mutex = &nlk->cb_def_mutex;
> mutex_init(nlk->cb_mutex);
> + lockdep_set_class_and_name(nlk->cb_mutex,
> + nlk_cb_mutex_keys + protocol,
> + nlk_cb_mutex_key_strings[protocol]);
> }
> init_waitqueue_head(&nlk->wait);
>
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Dmitry Vyukov <dvyukov@google.com> - 2017-03-05 16:10 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Dmitry Vyukov <dvyukov@google.com> - 2017-03-05 18:50 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Dmitry Vyukov <dvyukov@google.com> - 2017-03-06 10:50 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2017-03-14 16:30 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Dmitry Vyukov <dvyukov@google.com> - 2017-03-15 10:10 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2017-03-15 12:40 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Herbert Xu <herbert@gondor.apana.org.au> - 2017-03-14 10:20 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Herbert Xu <herbert@gondor.apana.org.au> - 2017-03-14 10:20 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Dmitry Vyukov <dvyukov@google.com> - 2017-03-14 10:50 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Herbert Xu <herbert@gondor.apana.org.au> - 2017-03-14 11:30 +0100
Re: crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex Dmitry Vyukov <dvyukov@google.com> - 2017-03-14 11:40 +0100
csiph-web