drm/drm_crtc: ensure dma_fence_ops remain valid during device unbind
NIST has received this entry but not started reviewing it.
In the Linux kernel, the following vulnerability has been resolved: drm/drm_crtc: ensure dma_fence_ops remain valid during device unbind In [1], sashiko reported the following issue: === snip === Looking at how these fences are managed, drm_crtc_create_fence() creates a dma_fence without taking a reference to the drm_device or drm_crtc. Because the sync_file framework exposes this fence to userspace, the fence can outlive the CRTC. The dma_fence contract requires that data accessed by dma_fence_ops (like get_driver_name) must remain valid for an RCU grace period after the fence is signaled. However, drm_crtc_cleanup() and the subsequent freeing of the device do not wait for an RCU grace period via synchronize_rcu(). If userspace calls ioctl(SYNC_IOC_FILE_INFO) concurrently with a device hot-unplug: CPU1 (Userspace) sync_file_get_name() ops = rcu_dereference(fence->ops); if (!dma_fence_test_signaled_flag()) // Preempted or delayed here CPU2 (Driver Teardown) Signals the fence (setting fence->ops = NULL) Destroys and frees the CRTC without waiting for an RCU grace period CPU1 (Resumes) ops->get_driver_name(fence) -> drm_crtc_fence_get_driver_name() crtc = fence_to_crtc(fence); // Casts to the freed CRTC return crtc->dev->driver->name; // Use-after-free ... Does the CRTC or DRM device need to be kept alive for the RCU grace period, or should the fence hold a proper reference to prevent the use-after-free when get_driver_name() and get_timeline_name() access the freed CRTC structure? === snap === I believe this to be a correct observation and this patch implements the suggestion of waiting for an RCU grace period before proceeding with destruction of the drm_crtc, so that get_driver_name() and get_timeline_name() can still work.
New to this? Read how to keep your software updated.
The products and versions NIST lists as vulnerable, 2 products in all. If what you run is not listed it is probably not affected, but ask your provider if you are unsure.
| Product | Type | Vulnerable versions | Fixed in |
|---|---|---|---|
| Linux Linux | Software | from 6d6003c4b613c93973e4e870d83f4bed2ad9ac34, before 6b046b7132b194c73078d237e4220497516011dd; from 6d6003c4b613c93973e4e870d83f4bed2ad9ac34, before 54c350d71a158f005c4613f32f1b0a57777d0a2a; from 6d6003c4b613c93973e4e870d83f4bed2ad9ac34, before 1b0bfef4e31f3c02ed54de519b15b840d5dad804; from 6d6003c4b613c93973e4e870d83f4bed2ad9ac34, before d07a8465cd50a78d55b745ed002d5accf4a6d0a6; from 6d6003c4b613c93973e4e870d83f4bed2ad9ac34, before dd9a96b2271e28340acf2e3764914fe5f32f6102; from 6d6003c4b613c93973e4e870d83f4bed2ad9ac34, before 07b2d7a3f2b984c20f5f2630a94f43ede387a8dc; and 2 more | 6b046b7132b194c73078d237e4220497516011dd; 54c350d71a158f005c4613f32f1b0a57777d0a2a; 1b0bfef4e31f3c02ed54de519b15b840d5dad804; d07a8465cd50a78d55b745ed002d5accf4a6d0a6 |
| Linux Linux | Software | 4.10 | not recorded |
The 7.8 severity score (high) from the company that reported it, broken into what it means in practice. Red means it makes the flaw easier or worse.
| How it is reached | On the machine | The attacker needs access to the computer itself, for example a login or a file they can get you to open. |
| How hard it is | Low | Easy to carry out. No special conditions have to line up. |
| Login needed | Low | The attacker needs an ordinary user account. |
| Someone has to act | None | Nobody has to click or open anything. It can happen on its own. |
| Reaches beyond the program | Unchanged | The damage stays inside the vulnerable program. |
| Data exposed | High | Total loss of confidentiality: the attacker can read all the data the program can reach. |
| Data changed | High | The attacker can change or delete anything the program can reach. |
| Service disrupted | High | The attacker can take the service down completely. |
| Ease of attack | 1.8 | A score for how easy it is to use the flaw. Higher is easier. |
| Damage | 5.9 | A score for how bad the harm is if it works. Higher is worse. |
NIST lists 8 sources for this flaw, none tagged as a vendor patch.