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]
Message-ID: <Zo/gevNqftePGvic@fedora>
Date: Thu, 11 Jul 2024 21:39:06 +0800
From: Ming Lei <ming.lei@...hat.com>
To: YangYang <yang.yang@...o.com>
Cc: Bart Van Assche <bvanassche@....org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jens Axboe <axboe@...nel.dk>, Omar Sandoval <osandov@...com>,
	linux-kernel@...r.kernel.org, linux-block@...r.kernel.org
Subject: Re: [PATCH v6] sbitmap: fix io hung due to race on
 sbitmap_word::cleared

On Thu, Jul 11, 2024 at 08:48:03PM +0800, YangYang wrote:
> On 2024/7/11 3:54, Bart Van Assche wrote:
> > On 7/9/24 11:56 PM, Yang Yang wrote:
> > > +    /**
> > > +     * @swap_lock: Held while swapping word <-> cleared
> > > +     */
> > > +    spinlock_t swap_lock;
> > 
> > Why is only swapping 'word' with 'cleared' protected by the spinlock?
> > If all 'cleared' changes would be protected by this spinlock then
> > that would allow to eliminate the expensive xchg() call from
> > sbitmap_deferred_clear().
> 
> The spinlock was initially introduced in ea86ea2cdced ("sbitmap:
> ammortize cost of clearing bits").
> I think if all 'cleared' changes are protected by the spinlock, the
> overhead of clearing tags would definitely increase.

There are only two WRITE on 'cleared':

- xchg(&map->cleared, 0) in sbitmap_deferred_clear()

- set_bit() in sbitmap_deferred_clear_bit()

xchg() supposes to provide such protection already.

Thanks,
Ming


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ