CVE-2026-72420: md/raid5: avoid R5_Overlap races while breaking stripe batches
In the Linux kernel, the following vulnerability has been resolved:
md/raid5: avoid R5Overlap races while breaking stripe batches
KCSAN report a race in breakstripebatchlist() vs. raid5makerequest() on sh->dev[i].flags (plain word write vs. atomic bit op)..
and .. one possible scenario is:
CPU1 CPU2 breakstripebatchlist(sh1) -> handle sh2 -> lock(sh2) -> sh2->batchhead = NULL -> unlock(sh2) -> testandclearbit(R5Overlap, sh2->dev[i].flags) -> wakeupbit(sh2->dev[i].flags) raid5makerequest() -> addallstripebios(sh2) -> lock(sh2) -> stripebiooverlaps(sh2) returns true batchhead is NULL, so new bio overlap exist bio on sh2 -> true -> setbit(R5Overlap, sh2->dev[i].flags) -> unlock(sh2) -> waitonbit(sh2->dev[i].flags) -> sh2->dev[i].flags = sh1->dev[i].flags & ~R5Overlap
No waitupbit(), CPU2 could be waitonbit() forever...
Fix by : - Expand the protect zone. - Use batchhead's device flag's snaphot when no held headsh->stripelock. - Move sh/headsh->batchhead = NULL to the end of protected zone , and , any concurrent addallstripebios() grabs sh->stripelock now either: - see batchhead != null, and , is rejected by stripebiooverlaps() under the lock (no R5Overlap wait ) , or , - sees batchhead == NULL, only after dev[i].flags has already been set and the prior R5Overlap waiters worken.
KCSAN report: ================================================ BUG: KCSAN: data-race in breakstripebatchlist / raid5makerequest
write (marked) to 0xffff8e89c8117548 of 8 bytes by task 4042 on cpu 0: raid5makerequest+0xea0/0x2930 mdhandlerequest+0x4a2/0xa40 mdsubmitbio+0x109/0x1a0 submitbio+0x2ec/0x390 submitbionoacctnocheck+0x457/0x710 submitbionoacct+0x2a7/0xc20 submitbio+0x56/0x250 blkdevdirectIO+0x54c/0xda0 blkdevwriteiter+0x38f/0x570 aiowrite+0x22b/0x490 iosubmitone+0xa51/0xf70 x64sysiosubmit+0xf7/0x220 x64syscall+0x1907/0x1c60 dosyscall64+0x130/0x570 entrySYSCALL64afterhwframe+0x76/0x7e
read to 0xffff8e89c8117548 of 8 bytes by task 4010 on cpu 5: breakstripebatchlist+0x249/0x480 handlestripecleanevent+0x720/0x9b0 handlestripe+0x32fb/0x4500 handleactivestripes.isra.0+0x6e0/0xa50 raid5d+0x7e0/0xba0 mdthread+0x15a/0x2d0 kthread+0x1e3/0x220 retfromfork+0x37a/0x410 retfromforkasm+0x1a/0x30
value changed: 0x0000000000000019 -> 0x0000000000000099 --> R5Overlap
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In md/raid5, adjust the stripe-batch breaking logic in break_stripe_batch_list()/raid5_make_request to avoid R5_Overlap data races: expand the protect zone; move sh/head_sh->batch_head = NULL to the end of the protected zone; when no held head_sh->stripe_lock, use batch_head’s device flag snapshot; and ensure stripe overlap detection/bit handling is ordered so that if stripe_bio_overlaps(sh2) returns true, the R5_Overlap bit is set/cleared in a way that paired wait_on_bit()/wake_up_bit() can’t wait forever (no missing wait_up_bit case).
Linux kernel (md/raid5) R5_Overlap synchronization during break_stripe_batch_list/raid5_make_request = Move sh/head_sh to end of protected zone; set batch_head snapshot semantics when no held stripe_lock; ensure stripe overlap wait-up bit cannot be missed - Operational
After applying the kernel fix, reboot/roll the updated kernel so the modified md/raid5 code (break_stripe_batch_list vs raid5_make_request and R5_Overlap handling) is actually used.