{"id":70176,"date":"2025-09-15T18:32:36","date_gmt":"2025-09-15T15:02:36","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2023-53235-drm-tests-helpers-avoid-a-driver-uaf\/"},"modified":"2025-09-15T18:32:36","modified_gmt":"2025-09-15T15:02:36","slug":"cve-2023-53235-drm-tests-helpers-avoid-a-driver-uaf","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2023-53235-drm-tests-helpers-avoid-a-driver-uaf\/","title":{"rendered":"CVE-2023-53235 &#8211; drm\/tests: helpers: Avoid a driver uaf"},"content":{"rendered":"<p><strong>CVE ID : <\/strong>CVE-2023-53235<br \/>\n<br \/>\n<strong>Published : <\/strong> Sept. 15, 2025, 2:22 p.m. | 32\u00a0minutes ago<br \/>\n<br \/>\n<strong>Description : <\/strong>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>drm\/tests: helpers: Avoid a driver uaf<\/p>\n<p>when using __drm_kunit_helper_alloc_drm_device() the driver may be<br \/>\ndereferenced by device-managed resources up until the device is<br \/>\nfreed, which is typically later than the kunit-managed resource code<br \/>\nfrees it. Fix this by simply make the driver device-managed as well.<\/p>\n<p>In short, the sequence leading to the UAF is as follows:<\/p>\n<p>INIT:<br \/>\nCode allocates a struct device as a kunit-managed resource.<br \/>\nCode allocates a drm driver as a kunit-managed resource.<br \/>\nCode allocates a drm device as a device-managed resource.<\/p>\n<p>EXIT:<br \/>\nKunit resource cleanup frees the drm driver<br \/>\nKunit resource cleanup puts the struct device, which starts a<br \/>\n      device-managed resource cleanup<br \/>\ndevice-managed cleanup calls drm_dev_put()<br \/>\ndrm_dev_put() dereferences the (now freed) drm driver -&gt; Boom.<\/p>\n<p>Related KASAN message:<br \/>\n[55272.551542] ==================================================================<br \/>\n[55272.551551] BUG: KASAN: slab-use-after-free in drm_dev_put.part.0+0xd4\/0xe0 [drm]\n[55272.551603] Read of size 8 at addr ffff888127502828 by task kunit_try_catch\/10353<\/p>\n[55272.551612] CPU: 4 PID: 10353 Comm: kunit_try_catch Tainted: G     U           N 6.5.0-rc7+ #155<br \/>\n[55272.551620] Hardware name: ASUS System Product Name\/PRIME B560M-A AC, BIOS 0403 01\/26\/2021<br \/>\n[55272.551626] Call Trace:<br \/>\n[55272.551629]\n[55272.551633]  dump_stack_lvl+0x57\/0x90<br \/>\n[55272.551639]  print_report+0xcf\/0x630<br \/>\n[55272.551645]  ? _raw_spin_lock_irqsave+0x5f\/0x70<br \/>\n[55272.551652]  ? drm_dev_put.part.0+0xd4\/0xe0 [drm]\n[55272.551694]  kasan_report+0xd7\/0x110<br \/>\n[55272.551699]  ? drm_dev_put.part.0+0xd4\/0xe0 [drm]\n[55272.551742]  drm_dev_put.part.0+0xd4\/0xe0 [drm]\n[55272.551783]  devres_release_all+0x15d\/0x1f0<br \/>\n[55272.551790]  ? __pfx_devres_release_all+0x10\/0x10<br \/>\n[55272.551797]  device_unbind_cleanup+0x16\/0x1a0<br \/>\n[55272.551802]  device_release_driver_internal+0x3e5\/0x540<br \/>\n[55272.551808]  ? kobject_put+0x5d\/0x4b0<br \/>\n[55272.551814]  bus_remove_device+0x1f1\/0x3f0<br \/>\n[55272.551819]  device_del+0x342\/0x910<br \/>\n[55272.551826]  ? __pfx_device_del+0x10\/0x10<br \/>\n[55272.551830]  ? lock_release+0x339\/0x5e0<br \/>\n[55272.551836]  ? kunit_remove_resource+0x128\/0x290 [kunit]\n[55272.551845]  ? __pfx_lock_release+0x10\/0x10<br \/>\n[55272.551851]  platform_device_del.part.0+0x1f\/0x1e0<br \/>\n[55272.551856]  ? _raw_spin_unlock_irqrestore+0x30\/0x60<br \/>\n[55272.551863]  kunit_remove_resource+0x195\/0x290 [kunit]\n[55272.551871]  ? _raw_spin_unlock_irqrestore+0x30\/0x60<br \/>\n[55272.551877]  kunit_cleanup+0x78\/0x120 [kunit]\n[55272.551885]  ? __kthread_parkme+0xc1\/0x1f0<br \/>\n[55272.551891]  ? __pfx_kunit_try_run_case_cleanup+0x10\/0x10 [kunit]\n[55272.551900]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10\/0x10 [kunit]\n[55272.551909]  kunit_generic_run_threadfn_adapter+0x4a\/0x90 [kunit]\n[55272.551919]  kthread+0x2e7\/0x3c0<br \/>\n[55272.551924]  ? __pfx_kthread+0x10\/0x10<br \/>\n[55272.551929]  ret_from_fork+0x2d\/0x70<br \/>\n[55272.551935]  ? __pfx_kthread+0x10\/0x10<br \/>\n[55272.551940]  ret_from_fork_asm+0x1b\/0x30<br \/>\n[55272.551948]  <\/p>\n[55272.551953] Allocated by task 10351:<br \/>\n[55272.551956]  kasan_save_stack+0x1c\/0x40<br \/>\n[55272.551962]  kasan_set_track+0x21\/0x30<br \/>\n[55272.551966]  __kasan_kmalloc+0x8b\/0x90<br \/>\n[55272.551970]  __kmalloc+0x5e\/0x160<br \/>\n[55272.551976]  kunit_kmalloc_array+0x1c\/0x50 [kunit]\n[55272.551984]  drm_exec_test_init+0xfa\/0x2c0 [drm_exec_test]\n[55272.551991]  kunit_try_run_case+0xdd\/0x250 [kunit]\n[55272.551999]  kunit_generic_run_threadfn_adapter+0x4a\/0x90 [kunit]\n[55272.552008]  kthread+0x2e7\/0x3c0<br \/>\n[55272.552012]  ret_from_fork+0x2d\/0x70<br \/>\n[55272.552017]  ret_from_fork_asm+0x1b\/0x30<\/p>\n[55272.552024] Freed by task 10353:<br \/>\n[55272.552027]  kasan_save_stack+0x1c\/0x40<br \/>\n[55272.552032]  kasan_set_track+0x21\/0x30<br \/>\n[55272.552036]  kasan_save_free_info+0x27\/0x40<br \/>\n[55272.552041]  __kasan_slab_free+0x106\/0x180<br \/>\n[55272.552046]  slab_free_freelist_hook+0xb3\/0x160<br \/>\n[55272.552051]  __kmem_cache_free+0xb2\/0x290<br \/>\n[55272.552056]  kunit_remove_resource+0x195\/0x290 [kunit]\n[55272.552064]  kunit_cleanup+0x7<br \/>\n&#8212;truncated&#8212;<br \/>\n<br \/>\n<strong>Severity:<\/strong> 0.0 | NA<br \/>\n<br \/>\nVisit the link for more details, such as CVSS details, affected products, timeline, and more&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CVE ID : CVE-2023-53235 Published : Sept. 15, 2025, 2:22 p.m. | 32\u00a0minutes ago Description : In the Linux kernel, the following vulnerability has been resolved: drm\/tests: helpers: Avoid a driver uaf when using __drm_kunit_helper_alloc_drm_device() the driver may be dereferenced by device-managed resources up until the device is freed, which is typically later than the &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-70176","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/70176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=70176"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/70176\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=70176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=70176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=70176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}