[Intel-gfx] [PATCH i-g-t 2/2] i915/gem_mmap_offset: Relax isolation rules

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 17 22:22:40 UTC 2020


It is legal for mmap_offset_ioctl to return the same offset for
different clients, so long as that offset is only valid for use with the
client's fd and no one elses.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_mmap_offset.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
index c3b85d29e..83e9890a5 100644
--- a/tests/i915/gem_mmap_offset.c
+++ b/tests/i915/gem_mmap_offset.c
@@ -233,15 +233,17 @@ static void isolation(int i915)
 		igt_assert(ptr == MAP_FAILED);
 		igt_assert_eq(errno, EACCES);
 
-		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, B, offset_a);
-		igt_assert(ptr == MAP_FAILED);
-		igt_assert_eq(errno, EACCES);
-
-		errno = 0;
-		ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_b);
-		igt_assert(ptr == MAP_FAILED);
-		igt_assert_eq(errno, EACCES);
+		if (offset_a != offset_b) {
+			errno = 0;
+			ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, B, offset_a);
+			igt_assert(ptr == MAP_FAILED);
+			igt_assert_eq(errno, EACCES);
+
+			errno = 0;
+			ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_b);
+			igt_assert(ptr == MAP_FAILED);
+			igt_assert_eq(errno, EACCES);
+		}
 
 		close(B);
 
-- 
2.25.0



More information about the Intel-gfx mailing list