diff mbox

[i-g-t] syncobj: add test for handle->fd + close twice.

Message ID 20171221025937.32670-1-airlied@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Airlie Dec. 21, 2017, 2:59 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

This demos a bug found in the vulkan CTS that causes
VFS: Close: file count is 0
in dmesg, and ls /proc/self/fd to oops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 tests/syncobj_basic.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Chris Wilson Dec. 21, 2017, 8:33 a.m. UTC | #1
Quoting Dave Airlie (2017-12-21 02:59:37)
> From: Dave Airlie <airlied@redhat.com>
> 
> This demos a bug found in the vulkan CTS that causes
> VFS: Close: file count is 0
> in dmesg, and ls /proc/self/fd to oops.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Aye catches the issue you found.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index acc4a641..42fc99f8 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -177,6 +177,22 @@  test_valid_cycle(int fd)
 	syncobj_destroy(fd, second_handle);
 }
 
+static void
+test_create_close_twice(int fd)
+{
+	uint32_t handle;
+	int syncobj_fd;
+
+	handle = syncobj_create(fd, 0);
+	syncobj_fd = syncobj_handle_to_fd(fd, handle, 0);
+	close(syncobj_fd);
+
+	syncobj_fd = syncobj_handle_to_fd(fd, handle, 0);
+	close(syncobj_fd);
+
+	syncobj_destroy(fd, handle);
+}
+
 static bool has_syncobj(int fd)
 {
 	uint64_t value;
@@ -231,4 +247,7 @@  igt_main
 	igt_subtest("test-valid-cycle")
 		test_valid_cycle(fd);
 
+	igt_subtest("test-create-close-twice")
+		test_create_close_twice(fd);
+
 }