CVE-2024-26757

Source
https://cve.org/CVERecord?id=CVE-2024-26757
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-26757.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-26757
Downstream
Related
Published
2024-04-03T17:00:41.633Z
Modified
2026-03-13T07:53:39.485484Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
md: Don't ignore read-only array in md_check_recovery()
Details

In the Linux kernel, the following vulnerability has been resolved:

md: Don't ignore read-only array in mdcheckrecovery()

Usually if the array is not read-write, mdcheckrecovery() won't register new syncthread in the first place. And if the array is read-write and syncthread is registered, mdsetreadonly() will unregister sync_thread before setting the array read-only. md/raid follow this behavior hence there is no problem.

After commit f52f5c71f3d4 ("md: fix stopping sync thread"), following hang can be triggered by test shell/integrity-caching.sh:

1) array is read-only. dm-raid update super block: rsupdatesbs ro = mddev->ro mddev->ro = 0 -> set array read-write mdupdatesb

2) register new sync thread concurrently.

3) dm-raid set array back to read-only: rsupdatesbs mddev->ro = ro

4) stop the array: raiddtr mdstop stopsyncthread setbit(MDRECOVERYINTR, &mddev->recovery); mdwakeupthreaddirectly(mddev->syncthread); waitevent(..., !testbit(MDRECOVERY_RUNNING, &mddev->recovery))

5) sync thread done: mddosync setbit(MDRECOVERYDONE, &mddev->recovery); mdwakeup_thread(mddev->thread);

6) daemon thread can't unregister sync thread: mdcheckrecovery if (!mdisrdwr(mddev) && !testbit(MDRECOVERYNEEDED, &mddev->recovery)) return; -> -> MDRECOVERY_RUNNING can't be cleared, hence step 4 hang;

The root cause is that dm-raid manipulate 'mddev->ro' by itself, however, dm-raid really should stop sync thread before setting the array read-only. Unfortunately, I need to read more code before I can refacter the handler of 'mddev->ro' in dm-raid, hence let's fix the problem the easy way for now to prevent dm-raid regression.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/26xxx/CVE-2024-26757.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
ecbfb9f118bce49f571675929160e4ecef91cc8a
Fixed
2ea169c5a0b1134d573d07fc27a16f327ad0e7d3
Fixed
55a48ad2db64737f7ffc0407634218cc6e4c513b

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-26757.json"