linux-stable/include/asm-generic/bitops
Mikulas Patocka 8238b45798 wait_on_bit: add an acquire memory barrier
There are several places in the kernel where wait_on_bit is not followed
by a memory barrier (for example, in drivers/md/dm-bufio.c:new_read).

On architectures with weak memory ordering, it may happen that memory
accesses that follow wait_on_bit are reordered before wait_on_bit and
they may return invalid data.

Fix this class of bugs by introducing a new function "test_bit_acquire"
that works like test_bit, but has acquire memory ordering semantics.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-08-26 09:30:25 -07:00
..
__ffs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
__fls.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
arch_hweight.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atomic.h locking/atomic: Make test_and_*_bit() ordered on failure 2022-08-16 09:19:43 -07:00
builtin-__ffs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-__fls.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-ffs.h asm-generic: ffs: Drop bogus reference to ffz location 2021-08-11 11:38:10 +02:00
builtin-fls.h fls: change parameter to unsigned int 2019-01-04 13:13:46 -08:00
const_hweight.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ext2-atomic-setbit.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ext2-atomic.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ffs.h asm-generic: ffs: Drop bogus reference to ffz location 2021-08-11 11:38:10 +02:00
ffz.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fls.h fls: change parameter to unsigned int 2019-01-04 13:13:46 -08:00
fls64.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
generic-non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
hweight.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
instrumented-atomic.h asm-generic/bitops: Always inline all bit manipulation helpers 2022-01-25 22:30:28 +01:00
instrumented-lock.h asm-generic/bitops, kcsan: Add instrumentation for barriers 2021-12-09 16:42:28 -08:00
instrumented-non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
le.h bitops: move find_bit_*_le functions from le.h to find.h 2022-01-15 08:47:30 -08:00
lock.h locking/atomic: add generic arch_*() bitops 2021-07-16 18:46:45 +02:00
non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
non-instrumented-non-atomic.h wait_on_bit: add an acquire memory barrier 2022-08-26 09:30:25 -07:00
sched.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00