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]
Date:   Wed, 19 Jan 2022 16:15:16 +0100
From:   David Hildenbrand <david@...hat.com>
To:     Boqun Feng <boqun.feng@...il.com>
Cc:     linux-kernel@...r.kernel.org, kexec@...ts.infradead.org,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        Baoquan He <bhe@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vivek Goyal <vgoyal@...hat.com>,
        Dave Young <dyoung@...hat.com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Josh Triplett <josh@...htriplett.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v1] proc/vmcore: fix false positive lockdep warning

On 19.01.22 16:08, Boqun Feng wrote:
> Hi,
> 
> On Wed, Jan 19, 2022 at 12:37:02PM +0100, David Hildenbrand wrote:
>> Lockdep complains that we do during mmap of the vmcore:
>> 	down_write(mmap_lock);
>> 	down_read(vmcore_cb_rwsem);
>> And during read of the vmcore:
>> 	down_read(vmcore_cb_rwsem);
>> 	down_read(mmap_lock);
>>
>> We cannot possibly deadlock when only taking vmcore_cb_rwsem in read
>> mode, however, it's hard to teach that to lockdep.
>>
> 
> Lockdep warned about the above sequences because rw_semaphore is a fair
> read-write lock, and the following can cause a deadlock:
> 
> 	TASK 1			TASK 2		TASK 3
> 	======			======		======
> 	down_write(mmap_lock);
> 				down_read(vmcore_cb_rwsem)
> 						down_write(vmcore_cb_rwsem); // blocked
> 	down_read(vmcore_cb_rwsem); // cannot get the lock because of the fairness
> 				down_read(mmap_lock); // blocked
> 	
> IOW, a reader can block another read if there is a writer queued by the
> second reader and the lock is fair.
> 
> So there is a deadlock possiblity.

Task 3 will never take the mmap_lock before doing a
down_write(vmcore_cb_rwsem).

How would this happen?


-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists