linux/drivers/gpu/drm/i915/selftests
Krzysztof Karas e8c3344765 drm/i915/selftests: Prevent userspace mapping invalidation
Migration testing in i915 assumes current task's address space
to allocate new userspace mapping and uses it without
registering real user for that address space in mm_struct.
On single NUMA node setups PCI probe executes in the same
context as userspace process calling the test (i915_selftest
from IGT), but when multiple nodes are available, the PCI code
puts probe into a kernel workqueue. This switches execution to
a kworker, which does not have its own address space in
userspace and must borrow such memory from another process, so
"current->active_mm" is unknown at the start of the test.

It was observed that mm->mm_users would occasionally be 0
or drop to 0 during the test due to short delay between
scheduling and executing work in forked process, which reaped
userspace mappings, further leading to failures upon reading
from userland memory.

Prevent this by adding a PID parameter to a trusted task, so its
mm_struct may be used if needed.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14204
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20260508080214.1979686-2-krzysztof.karas@intel.com
2026-05-19 13:28:49 +02:00
..
i915_active.c drm/i915/selftests: Fix build after dma-fence locking rework 2026-02-24 09:34:48 -08:00
i915_gem_evict.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i915_gem_gtt.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
i915_gem.c Merge tag 'drm-intel-gt-next-2025-02-26' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2025-03-13 07:54:41 +10:00
i915_live_selftests.h
i915_mock_selftests.h
i915_perf_selftests.h
i915_perf.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i915_random.c
i915_random.h
i915_request.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
i915_selftest.c drm/i915/selftests: Prevent userspace mapping invalidation 2026-05-19 13:28:49 +02:00
i915_sw_fence.c drm/i915: add WQ_PERCPU to alloc_workqueue users 2026-03-05 13:58:23 -05:00
i915_syncmap.c
i915_vma.c drm/i915/selftests: fix typos in i915/selftests files 2025-01-23 05:48:23 -05:00
igt_atomic.c
igt_atomic.h
igt_flush_test.c drm/i915/selftests: Use preemption timeout on cleanup 2024-12-20 23:34:43 +01:00
igt_flush_test.h
igt_live_test.c
igt_live_test.h
igt_mmap.c drm/i915/selftests: Keep mock file open during unfaultable migrate with fill 2026-01-27 17:26:21 +01:00
igt_mmap.h drm/i915/selftests: Keep mock file open during unfaultable migrate with fill 2026-01-27 17:26:21 +01:00
igt_reset.c
igt_reset.h
igt_spinner.c drm/i915: split out i915_wait_util.h 2025-09-12 11:08:45 +03:00
igt_spinner.h
intel_memory_region.c gpu: Move DRM buddy allocator one level up (part two) 2026-02-06 11:38:35 +10:00
intel_scheduler_helpers.c
intel_scheduler_helpers.h
intel_uncore.c drm/i915/selftests: Nuke live_forcewake_domains selftest 2026-03-27 13:08:22 +02:00
lib_sw_fence.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
lib_sw_fence.h
librapl.c x86/msr: Rename 'rdmsrl_safe()' to 'rdmsrq_safe()' 2025-04-10 11:58:38 +02:00
librapl.h
mock_drm.h
mock_gem_device.c drm/i915: Clear i915->display when no longer valid 2026-04-16 17:47:06 +03:00
mock_gem_device.h
mock_gtt.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mock_gtt.h
mock_region.c
mock_region.h
mock_request.c drm/i915/selftests: Change mock_request() to return error pointers 2025-06-26 10:53:59 -04:00
mock_request.h
mock_uncore.c
mock_uncore.h
scatterlist.c