Linux kernel use-after-free in device mapper resume
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ d58168763f74d1edbc296d7038c60efe6493fdd4 · < e3bf232c913b7e0103d323f15e6342d37cb1b357| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
dm: fix reading free memory in do_resume
When do_resume calls dm_table_get_mode(new_map), the call is done without holding any locks (it only holds a reference to the md). It may be possible that another concurrent ioctl on the same device will swap table after dm_swap_table and before dm_table_get_mode. In this case, dm_table_get_mode(new_map) reads freed memory.
This race condition was triggered by syzbot.
This commit fixes the race by reading mode of the new table before dm_swap_table. Note that new_map is also passed to dm_ima_need_measure, but this function doesn't attempt to dereference it, so this call should be safe.
Note that this is not a security bug because only root can trigger it and the commonly used tools such as lvm or cryptsetup do not call the ioctls concurrently, so that they can't trigger it acceidentally.
From the CVE record · Linux
A race in the Linux kernel's device mapper can cause do_resume to read freed memory. Triggering it requires root to issue concurrent ioctls on the same device; commonly used tools such as lvm and cryptsetup do not issue those ioctls concurrently.
Engineers running Linux kernels with device mapper should check whether their kernel includes the fix; affected versions were not specified.