CVE-2024-26757
Severity CVSS v4.0:
Pending analysis
Type:
CWE-404
Improper Resource Shutdown or Release
Publication date:
03/04/2024
Last modified:
04/04/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
md: Don&#39;t ignore read-only array in md_check_recovery()<br />
<br />
Usually if the array is not read-write, md_check_recovery() won&#39;t<br />
register new sync_thread in the first place. And if the array is<br />
read-write and sync_thread is registered, md_set_readonly() will<br />
unregister sync_thread before setting the array read-only. md/raid<br />
follow this behavior hence there is no problem.<br />
<br />
After commit f52f5c71f3d4 ("md: fix stopping sync thread"), following<br />
hang can be triggered by test shell/integrity-caching.sh:<br />
<br />
1) array is read-only. dm-raid update super block:<br />
rs_update_sbs<br />
ro = mddev->ro<br />
mddev->ro = 0<br />
-> set array read-write<br />
md_update_sb<br />
<br />
2) register new sync thread concurrently.<br />
<br />
3) dm-raid set array back to read-only:<br />
rs_update_sbs<br />
mddev->ro = ro<br />
<br />
4) stop the array:<br />
raid_dtr<br />
md_stop<br />
stop_sync_thread<br />
set_bit(MD_RECOVERY_INTR, &mddev->recovery);<br />
md_wakeup_thread_directly(mddev->sync_thread);<br />
wait_event(..., !test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))<br />
<br />
5) sync thread done:<br />
md_do_sync<br />
set_bit(MD_RECOVERY_DONE, &mddev->recovery);<br />
md_wakeup_thread(mddev->thread);<br />
<br />
6) daemon thread can&#39;t unregister sync thread:<br />
md_check_recovery<br />
if (!md_is_rdwr(mddev) &&<br />
!test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))<br />
return;<br />
-> -> MD_RECOVERY_RUNNING can&#39;t be cleared, hence step 4 hang;<br />
<br />
The root cause is that dm-raid manipulate &#39;mddev->ro&#39; by itself,<br />
however, dm-raid really should stop sync thread before setting the<br />
array read-only. Unfortunately, I need to read more code before I<br />
can refacter the handler of &#39;mddev->ro&#39; in dm-raid, hence let&#39;s fix<br />
the problem the easy way for now to prevent dm-raid regression.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
CPE | From | Up to |
---|---|---|
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.8 (including) | 6.7.7 (excluding) |
cpe:2.3:o:linux:linux_kernel:6.8:rc1:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:6.8:rc2:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:6.8:rc3:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:6.8:rc4:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:6.8:rc5:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page