]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/ttm/tests: add a test to exercise ttm_bo_swapout
authorThadeu Lima de Souza Cascardo <cascardo@igalia.com>
Mon, 9 Mar 2026 18:47:04 +0000 (15:47 -0300)
committerTvrtko Ursulin <tursulin@ursulin.net>
Thu, 12 Mar 2026 10:53:22 +0000 (10:53 +0000)
commitd11ac9043435cf1ddf1abc59fa774eb6c0ca4e51
tree4caa311d7254457e2f449514505c680355c118dc
parentacee19f998234c4aec88c5fab364780312ba17e9
drm/ttm/tests: add a test to exercise ttm_bo_swapout

Currently, ttm_bo_swapout is not exercised by the TTM KUnit tests.

It used to be exercised until commit 76689eb52667 ("drm/ttm: remove
ttm_bo_validate_swapout test"), but that test was removed as it was
unreliable due to requiring to allocate half of the system memory.

Calling ttm_bo_swapout directly with a single allocated BO, however, does
not suffer from that problem, and was able to detect a UAF introduced by
commit c06da4b3573a ("drm/ttm: Tidy usage of local variables a little
bit"), when built with KASAN.

When applying a fix to that UAF, the test passed without any issues.

Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
Link: https://lore.kernel.org/r/20260309-ttm_bo_swapout_test-v2-1-219f64046cfe@igalia.com
drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
drivers/gpu/drm/ttm/ttm_bo.c