mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
8238b45798
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>
18 lines
588 B
C
18 lines
588 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __ASM_GENERIC_BITOPS_NON_INSTRUMENTED_NON_ATOMIC_H
|
|
#define __ASM_GENERIC_BITOPS_NON_INSTRUMENTED_NON_ATOMIC_H
|
|
|
|
#define ___set_bit arch___set_bit
|
|
#define ___clear_bit arch___clear_bit
|
|
#define ___change_bit arch___change_bit
|
|
|
|
#define ___test_and_set_bit arch___test_and_set_bit
|
|
#define ___test_and_clear_bit arch___test_and_clear_bit
|
|
#define ___test_and_change_bit arch___test_and_change_bit
|
|
|
|
#define _test_bit arch_test_bit
|
|
#define _test_bit_acquire arch_test_bit_acquire
|
|
|
|
#endif /* __ASM_GENERIC_BITOPS_NON_INSTRUMENTED_NON_ATOMIC_H */
|