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] [day] [month] [year] [list]
Message-ID: <17038403.1mEsPFdYFf@adelgunde>
Date:	Tue, 10 Nov 2015 11:22:45 +0100
From:	Markus Pargmann <mpa@...gutronix.de>
To:	Al Viro <viro@...iv.linux.org.uk>
Cc:	nbd-general@...ts.sourceforge.net, Oleg Nesterov <oleg@...hat.com>,
	Christoph Hellwig <hch@...radead.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] nbd: Remove signal usage

Hi,

On Tuesday 10 November 2015 04:46:18 Al Viro wrote:
> On Thu, Oct 29, 2015 at 04:42:37PM +0100, Markus Pargmann wrote:
> >  	del_timer_sync(&nbd->timeout_timer);
> > +
> > +out:
> > +	spin_unlock_irq(&nbd->sock_lock);
> 
> ... and in its callback we have this:
> 
> > @@ -148,17 +155,15 @@ static void nbd_xmit_timeout(unsigned long arg)
> >  
> >  	nbd->disconnect = true;
> >  
> > -	spin_lock_irqsave(&nbd->tasks_lock, flags);
> > +	spin_lock_irqsave(&nbd->sock_lock, flags);
> 
> * CPU 1 enters sock_shutdown() and grabs ->sock_lock.
> * on CPU2 the timer hits and we enter the callback, where we spin on that
> spinlock.
> * in the meanwhile, CPU1 calls del_timer_sync()
> 
> Deadlock...

Thank you. Yes that locking block in sock_shutdown is to large. And probably
the del_timer_sync() isn't necessary, we can just use del_timer().

It may even be possible to remove the sock_lock completely. Will look into this
and post a v2.

Thanks,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ