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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82e268d4-22fa-3e33-8988-a3a367fae7b1@ispras.ru>
Date:   Sat, 11 Mar 2017 00:54:26 +0300
From:   Alexey Khoroshilov <khoroshilov@...ras.ru>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Vitaly Wool <vitalywool@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Dan Streetman <ddstreet@...e.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org
Subject: Re: z3fold: suspicious return with spinlock held

On 11.03.2017 00:34, Matthew Wilcox wrote:
> On Sat, Mar 11, 2017 at 12:22:12AM +0300, Alexey Khoroshilov wrote:
>> Hello!
>>
>> z3fold_reclaim_page() contains the only return that may
>> leave the function with pool->lock spinlock held.
>>
>> 669 	spin_lock(&pool->lock);
>> 670 	if (kref_put(&zhdr->refcount, release_z3fold_page)) {
>> 671 		atomic64_dec(&pool->pages_nr);
>> 672 		return 0;
>> 673 	}
>>
>> May be we need spin_unlock(&pool->lock); just before return?
> 
> I would tend to agree.  sparse warns about this, and also about two
> other locking problems ... which I'm not sure are really problems so
> much as missing annotations?
> 
> mm/z3fold.c:467:35: warning: context imbalance in 'z3fold_alloc' - unexpected unlock
> mm/z3fold.c:519:26: warning: context imbalance in 'z3fold_free' - different lock contexts for basic block
> mm/z3fold.c:581:12: warning: context imbalance in 'z3fold_reclaim_page' - different lock contexts for basic block
> 

I also do not see problems in z3fold_alloc() and z3fold_free().
But I am unaware of sparse annotations that can help here.

--
Alexey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ