Linux kernel locking failure in dm cache background work
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b29d4986d0da1a27cd35917cdb433672f5c95d7f · < 73df2ff409f3db95029982fe3656329568e3715d| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
dm cache: fix issue with background work locking
dm cache used a rw_semaphore for background_work_lock. Write locks on rw_semaphores have strict owner semantics, but there was no guarantee that the process that locked background_work_lock was the same process that unlocked it. This can be easily seen using a kernel compiled with CONFIG_DEBUG_RWSEMS. Given a dm cache device <cache>, run: 'dmsetup suspend <cache> && dmsetup resume <cache>'. This will trigger a kernel warning:
DEBUG_RWSEMS_WARN_ON((rwsem_owner(sem) != current) && !rwsem_test_oflags(sem, RWSEM_NONSPINNABLE))
triggered by cache_resume(). To fix this, switch from a rw_semaphore to a spinlock and a wait queue. dm cache already has a wait queue and associated counter, migration_wait and nr_allocated_migrations, that was getting woken up when background work was getting completed, but wasn't actually used by anything. This is replaced by the background_work queue and counter.
From the CVE record · Linux
The Linux kernel’s dm cache uses a lock whose write-lock ownership can be violated during background work. Suspending and resuming a dm cache device can trigger a kernel warning when CONFIG_DEBUG_RWSEMS is enabled. The input does not describe a remote attack or specify authentication requirements.
Engineers running Linux kernels with dm cache should check their systems; affected versions are not specified.