public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection
@ 2026-01-29  0:31 Jia Yao
  2026-01-29 16:39 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (24 more replies)
  0 siblings, 25 replies; 27+ messages in thread
From: Jia Yao @ 2026-01-29  0:31 UTC (permalink / raw)
  To: igt-dev; +Cc: Jia Yao

UC PAT index with CPU cached memory (system allocator) is now rejected
by kernel to prevent security issues where GPU could bypass CPU cache
and read stale sensitive data from DRAM.

Modify UC PAT index tests to verify kernel correctly rejects the madvise
call with -EINVAL, instead of attempting to execute batch buffers.

UC_COMP tests are not affected as they require VRAM which uses different
caching.

Signed-off-by: Jia Yao <jia.yao@intel.com>
---
 tests/intel/xe_exec_system_allocator.c | 44 ++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/tests/intel/xe_exec_system_allocator.c b/tests/intel/xe_exec_system_allocator.c
index 20282fe8a..41194e460 100644
--- a/tests/intel/xe_exec_system_allocator.c
+++ b/tests/intel/xe_exec_system_allocator.c
@@ -2604,6 +2604,50 @@ int igt_main()
 			     !xe_has_vram(fd)) {
 				igt_skip("Skipping compression-related PAT index\n");
 			}
+
+			/*
+			 * UC PAT index with CPU cached memory (system allocator)
+			 * is rejected by kernel to prevent security issues.
+			 * Only verify madvise returns -EINVAL.
+			 */
+			if (strstr(s->name, "madvise-pat-idx-uc-")) {
+				struct drm_xe_sync sync[1] = {
+					{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+					.flags = DRM_XE_SYNC_FLAG_SIGNAL, },
+				};
+				uint64_t addr;
+				uint32_t vm;
+				void *data;
+				int err;
+				uint64_t bind_sync = 0;
+
+				vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_LR_MODE |
+						  DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);
+				data = aligned_alloc(SZ_4K, SZ_4M);
+				igt_assert(data);
+				memset(data, 0, SZ_4M);
+				addr = to_user_pointer(data);
+
+				/* Bind memory to create VMA first */
+				sync[0].addr = to_user_pointer(&bind_sync);
+				sync[0].timeline_value = 1;
+				__xe_vm_bind_assert(fd, vm, 0, 0, 0, addr, SZ_4M,
+						    DRM_XE_VM_BIND_OP_MAP,
+						    DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR,
+						    sync, 1, 0, 0);
+				xe_wait_ufence(fd, &bind_sync, 1, 0, FIVE_SEC);
+
+				/* Now madvise should fail with -EINVAL */
+				err = __xe_vm_madvise(fd, vm, addr, SZ_4M, 0,
+						      DRM_XE_MEM_RANGE_ATTR_PAT,
+						      s->fn(fd), 0, 0);
+				igt_assert_eq(err, -EINVAL);
+
+				free(data);
+				xe_vm_destroy(fd, vm);
+				continue;
+			}
+
 			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 1, SZ_4M, 0, 0, NULL, NULL, s->flags, s->fn);
 		}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2026-02-05 16:20 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29  0:31 [PATCH] tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection Jia Yao
2026-01-29 16:39 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-01-29 16:45 ` ✓ i915.CI.BAT: " Patchwork
2026-01-29 19:26 ` [PATCH] " Wang, X
2026-01-29 22:51 ` [PATCH v2] " Jia Yao
2026-01-29 23:37 ` ✓ Xe.CI.BAT: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev2) Patchwork
2026-01-29 23:46 ` ✓ i915.CI.BAT: " Patchwork
2026-01-30  0:01 ` [PATCH v3] tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection Jia Yao
2026-01-30  1:28 ` ✓ i915.CI.Full: success for " Patchwork
2026-01-30  1:36 ` ✓ Xe.CI.BAT: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev3) Patchwork
2026-01-30  1:52 ` ✓ i915.CI.BAT: " Patchwork
2026-01-30  8:09 ` ✗ i915.CI.Full: failure for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev2) Patchwork
2026-01-30 10:28 ` ✓ i915.CI.Full: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev3) Patchwork
2026-01-30 20:12 ` [PATCH v4] tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection Jia Yao
2026-01-30 23:04   ` Wang, X
2026-01-30 21:20 ` ✓ Xe.CI.BAT: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev4) Patchwork
2026-01-30 21:27 ` ✓ i915.CI.BAT: " Patchwork
2026-01-30 23:57 ` [PATCH v5] tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection Jia Yao
2026-01-31  0:47 ` ✓ Xe.CI.BAT: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev5) Patchwork
2026-01-31  1:09 ` ✓ i915.CI.BAT: " Patchwork
2026-01-31  7:27 ` ✓ i915.CI.Full: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev4) Patchwork
2026-01-31  9:46 ` ✓ i915.CI.Full: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev5) Patchwork
2026-02-04 23:24 ` [PATCH v6] tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection Jia Yao
2026-02-05  0:27 ` ✓ i915.CI.BAT: success for tests/intel/xe_exec_system_allocator: Expect UC PAT madvise rejection (rev6) Patchwork
2026-02-05  0:28 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-05 15:00 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-05 16:19 ` ✗ i915.CI.Full: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox