summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-10-09 19:36:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-12-13 12:01:31 +0000
commit7b97292ba7f70df98e38b925e715d86096ce98f9 (patch)
treed2e961a07ea30d2c8903fb2fc801d7b3e3f70a37
parent7afcc75fab0c9ba47f87572ea3ebdcbdd887307d (diff)
i915/gem_userptr_blits: Test execution isolation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/i915/gem_userptr_blits.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 5e6973be..73969275 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -837,6 +837,40 @@ static int test_access_control(int fd)
return 0;
}
+static void test_exec_isolation(int fd)
+{
+ igt_fork(child, 1) {
+ igt_spin_t *spin = igt_spin_new(fd, .flags = IGT_SPIN_USERPTR);
+ gem_execbuf(fd, &spin->execbuf);
+ igt_spin_free(fd, spin);
+ }
+
+ igt_set_timeout(10, "blocked!");
+ igt_until_timeout(2)
+ igt_spin_free(fd, igt_spin_new(fd, .flags = IGT_SPIN_USERPTR));
+ igt_reset_timeout();
+
+ igt_waitchildren();
+}
+
+static void test_unmap_isolation(int fd)
+{
+ igt_spin_t *spin = igt_spin_new(fd, .flags = IGT_SPIN_USERPTR);
+
+ igt_fork(child, 1) {
+ gem_execbuf(fd, &spin->execbuf);
+ munmap(spin->batch, 4096);
+ }
+ igt_waitchildren();
+
+ igt_spin_end(spin);
+ mprotect(spin->batch, 4096, PROT_READ);
+ igt_assert_eq(__gem_execbuf(fd, &spin->execbuf), -EFAULT);
+ mprotect(spin->batch, 4096, PROT_WRITE);
+
+ igt_spin_free(fd, spin);
+}
+
static int test_invalid_null_pointer(int fd)
{
uint32_t handle;
@@ -2648,6 +2682,12 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)
igt_subtest("huge-split")
test_huge_split(fd);
+
+ igt_subtest("exec-isolation")
+ test_exec_isolation(fd);
+
+ igt_subtest("unmap-isolation")
+ test_unmap_isolation(fd);
}
igt_subtest("access-control")