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  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:	Wed, 29 Oct 2014 09:29:55 -0700
From:	Cong Wang <xiyou.wangcong@...il.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Fengguang Wu <fengguang.wu@...el.com>, LKP <lkp@...org>,
	LKML <linux-kernel@...r.kernel.org>,
	"oleg@...hat.com" <oleg@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	David Miller <davem@...emloft.net>,
	Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH] netdev: Fix sleeping inside wait event

(Adding netdev@...)

On Wed, Oct 29, 2014 at 9:16 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> Dave, this relies on bits currently in tip/sched/core, if you're ok I'll
> merge it through that tree.
>
> ---
> Subject: netdev: Fix sleeping inside wait event
> From: Peter Zijlstra <peterz@...radead.org>
> Date: Wed Oct 29 17:04:56 CET 2014
>
> rtnl_lock_unregistering() takes rtnl_lock() -- a mutex -- inside a
> wait loop. The wait loop relies on current->state to function, but so
> does mutex_lock(), nesting them makes for the inner to destroy the
> outer state.
>

While you are on it, please fix rtnl_lock_unregistering_all() too?

Thanks!

> Fix this using the new wait_woken() bits.
>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Cc: Eric Biederman <ebiederm@...ssion.com>
> Cc: David Miller <davem@...emloft.net>
> Reported-by: Fengguang Wu <fengguang.wu@...el.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
>  net/core/dev.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -7196,11 +7196,10 @@ static void __net_exit rtnl_lock_unregis
>          */
>         struct net *net;
>         bool unregistering;
> -       DEFINE_WAIT(wait);
> +       DEFINE_WAIT_FUNC(wait, woken_wake_function);
>
> +       add_wait_queue(&netdev_unregistering_wq, &wait);
>         for (;;) {
> -               prepare_to_wait(&netdev_unregistering_wq, &wait,
> -                               TASK_UNINTERRUPTIBLE);
>                 unregistering = false;
>                 rtnl_lock();
>                 list_for_each_entry(net, net_list, exit_list) {
> @@ -7212,9 +7211,10 @@ static void __net_exit rtnl_lock_unregis
>                 if (!unregistering)
>                         break;
>                 __rtnl_unlock();
> -               schedule();
> +
> +               wait_woken(&wait, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
>         }
> -       finish_wait(&netdev_unregistering_wq, &wait);
> +       remove_wait_queue(&netdev_unregistering_wq, &wait);
>  }
>
>  static void __net_exit default_device_exit_batch(struct list_head *net_list)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
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