mbox series

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

Message ID 20230906095039.3320-1-thomas.hellstrom@linux.intel.com (mailing list archive)
Headers show
Series drm/drm_exec, drm/tests: Fix / WA for uaf and lock alloc tracking | expand

Message

Thomas Hellstrom Sept. 6, 2023, 9:50 a.m. UTC
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@amd.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Danilo Krummrich <dakr@redhat.com>
Cc: dri-devel@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(-)