[Intel-xe] [PATCH v2 0/3] drm/drm_exec, drm/tests: Fix / WA for uaf and lock alloc tracking

Thomas Hellström thomas.hellstrom at linux.intel.com
Wed Sep 6 09:50:36 UTC 2023


While trying to replicate a weird drm_exec lock alloc tracking warning
using the drm_exec kunit test, the warning was shadowed by a UAF warning
from KASAN due to a bug in the drm kunit helpers.

Patch 1 fixes that drm kunit UAF.
Patch 2 introduces a drm_exec kunit subtest that shows the weird lock
alloc tracking warning if CONFIG_DEBUG_LOCK_ALLOC is set.
Patch 3 modifies drm_exec to avoid that lock alloc tracking warning. Although
the proper fix would probably be to modify lockdep to track the lock held
status differently, this workaround pushes the problem out of drm_exec,
so that any drm_exec users relying on its refcounting don't run into this.

v2:
- Rewording of commit messages
- Fix a typo (Danilo Krummrich)
- Add some commit message tags

Cc: Christian König <christian.koenig at amd.com>
Cc: Boris Brezillon <boris.brezillon at collabora.com>
Cc: Danilo Krummrich <dakr at redhat.com>
Cc: dri-devel at lists.freedesktop.org

Thomas Hellström (3):
  drm/tests: helpers: Avoid a driver uaf
  drm/tests/drm_exec: Add a test for object freeing within
    drm_exec_fini()
  drm/drm_exec: Work around a WW mutex lockdep oddity

 drivers/gpu/drm/drm_exec.c            |  2 +-
 drivers/gpu/drm/tests/drm_exec_test.c | 47 +++++++++++++++++++++++++++
 include/drm/drm_exec.h                | 35 +++++++++++++++++---
 include/drm/drm_kunit_helpers.h       |  4 ++-
 4 files changed, 82 insertions(+), 6 deletions(-)

-- 
2.41.0



More information about the Intel-xe mailing list