[igt-dev] [PATCH i-g-t] i915/gem_mmap_gtt: Test mmap_gtt extension validity
Abdiel Janulgue
abdiel.janulgue at linux.intel.com
Thu Nov 21 13:09:15 UTC 2019
If we accidentally modify the mmap_gtt ioctl struct sizes in our headers,
we might end up feeding garbage into the ioctl and start validating
that as our flags for the upcoming mmap_offset ioctl. This ensures header
changes don't mess up with our existing mmap_gtt ioctl.
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
tests/i915/gem_mmap_gtt.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index a5f9d934..4ea54ef1 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -116,6 +116,20 @@ test_access(int fd)
MAP_SHARED, fd2, mmap_arg.offset));
}
+static void
+test_zero_extend(int i915)
+{
+ struct drm_i915_gem_mmap_gtt arg = {};
+ uint64_t redzone[16];
+
+ memset(redzone, 0xc5, sizeof(redzone));
+ arg.handle = gem_create(i915, 4096);
+
+ igt_assert_eq(ioctl(i915, DRM_IOCTL_I915_GEM_MMAP_GTT, &arg), 0);
+
+ gem_close(i915, arg.handle);
+}
+
static void
test_short(int fd)
{
@@ -1091,6 +1105,8 @@ igt_main
test_wc(fd);
igt_subtest("isolation")
test_isolation(fd);
+ igt_subtest("zero-extend")
+ test_zero_extend(fd);
igt_subtest("close-race")
test_close_race(fd);
igt_subtest("flink-race")
--
2.23.0
More information about the igt-dev
mailing list