linux/drivers/block
Qiu-ji Chen 2f02b5af3a drbd: Fix atomicity violation in drbd_uuid_set_bm()
The violation of atomicity occurs when the drbd_uuid_set_bm function is
executed simultaneously with modifying the value of
device->ldev->md.uuid[UI_BITMAP]. Consider a scenario where, while
device->ldev->md.uuid[UI_BITMAP] passes the validity check when its
value is not zero, the value of device->ldev->md.uuid[UI_BITMAP] is
written to zero. In this case, the check in drbd_uuid_set_bm might refer
to the old value of device->ldev->md.uuid[UI_BITMAP] (before locking),
which allows an invalid value to pass the validity check, resulting in
inconsistency.

To address this issue, it is recommended to include the data validity
check within the locked section of the function. This modification
ensures that the value of device->ldev->md.uuid[UI_BITMAP] does not
change during the validation process, thereby maintaining its integrity.

This possible bug is found by an experimental static analysis tool
developed by our team. This tool analyzes the locking APIs to extract
function pairs that can be concurrently executed, and then analyzes the
instructions in the paired functions to identify possible concurrency
bugs including data races and atomicity violations.

Fixes: 9f2247bb9b ("drbd: Protect accesses to the uuid set with a spinlock")
Cc: stable@vger.kernel.org
Signed-off-by: Qiu-ji Chen <chenqiuji666@gmail.com>
Reviewed-by: Philipp Reisner <philipp.reisner@linbit.com>
Link: https://lore.kernel.org/r/20240913083504.10549-1-chenqiuji666@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-09-18 04:16:23 -06:00
..
aoe block: move the nonrot flag to queue_limits 2024-06-19 07:58:28 -06:00
drbd drbd: Fix atomicity violation in drbd_uuid_set_bm() 2024-09-18 04:16:23 -06:00
mtip32xx mtip32xx: Remove redundant null pointer checks in mtip_hw_debugfs_init() 2024-09-07 07:40:49 -06:00
null_blk null_blk: Don't bother validating blocksize 2024-07-09 00:00:17 -06:00
rnbd block/rnbd-srv: Add sanity check and remove redundant assignment 2024-08-28 08:50:35 -06:00
xen-blkback xen/blkback: add missing MODULE_DESCRIPTION() macro 2024-07-10 00:21:18 -06:00
zram zram: Shrink zram_table_entry::flags. 2024-09-06 08:51:08 -06:00
amiflop.c Merge branch 'for-6.11/block-limits' into for-6.11/block 2024-06-19 08:14:49 -06:00
ataflop.c Merge branch 'for-6.11/block-limits' into for-6.11/block 2024-06-19 08:14:49 -06:00
brd.c brd: add missing MODULE_DESCRIPTION() macro 2024-06-24 08:38:52 -06:00
floppy.c floppy: add missing MODULE_DESCRIPTION() macro 2024-07-10 00:22:03 -06:00
Kconfig rust: block: add rnull, Rust null_blk implementation 2024-06-14 07:45:04 -06:00
loop.c for-6.11/block-20240710 2024-07-15 14:20:22 -07:00
Makefile rust: block: add rnull, Rust null_blk implementation 2024-06-14 07:45:04 -06:00
n64cart.c block: move the nonrot flag to queue_limits 2024-06-19 07:58:28 -06:00
nbd.c nbd: correct the maximum value for discard sectors 2024-09-06 08:31:40 -06:00
pktcdvd.c pktcdvd: remove unnecessary debugfs_create_dir() error check 2024-08-27 09:18:08 -06:00
ps3disk.c block: move the nonrot flag to queue_limits 2024-06-19 07:58:28 -06:00
ps3vram.c block: pass a queue_limits argument to blk_alloc_disk 2024-02-19 16:58:23 -07:00
rbd_types.h
rbd.c A small patchset to address bogus I/O errors and ultimately an 2024-07-26 10:34:42 -07:00
rnull.rs rust: block: add rnull, Rust null_blk implementation 2024-06-14 07:45:04 -06:00
sunvdc.c block: move the nonrot flag to queue_limits 2024-06-19 07:58:28 -06:00
swim3.c block: move the nonrot flag to queue_limits 2024-06-19 07:58:28 -06:00
swim_asm.S
swim.c block: move the nonrot flag to queue_limits 2024-06-19 07:58:28 -06:00
ublk_drv.c Linux 6.11 2024-09-17 08:32:53 -06:00
virtio_blk.c virtio: features, fixes, cleanups 2024-07-19 11:57:55 -07:00
xen-blkfront.c xen-blkfront: fix sector_size propagation to the block layer 2024-07-02 08:58:12 -06:00
z2ram.c z2ram: add missing MODULE_DESCRIPTION() macro 2024-06-19 07:54:00 -06:00