[igt-dev] [PATCH 7/7] tests/panfrost: Test FD-close while jobs are still in-flight

Boris Brezillon boris.brezillon at collabora.com
Mon Jun 21 12:57:24 UTC 2021


We had use-after-free faults in the past because the MMU context
while released while jobs were still in flight, and the job cleanup
path assumed the context was still present. Add a test to make sure this
won't happen again.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
 tests/panfrost_submit.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/panfrost_submit.c b/tests/panfrost_submit.c
index aa2c277bbdb6..ef2437d60ab7 100644
--- a/tests/panfrost_submit.c
+++ b/tests/panfrost_submit.c
@@ -159,6 +159,17 @@ igt_main
                 close(tmpfd);
         }
 
+        igt_subtest("pan-submit-and-close") {
+                /* We need our own FD because we close it right after the job submission */
+                int tmpfd = drm_open_driver(DRIVER_PANFROST);
+                struct panfrost_submit *submit;
+
+                submit = igt_panfrost_job_loop(tmpfd);
+                do_ioctl(tmpfd, DRM_IOCTL_PANFROST_SUBMIT, submit->args);
+                igt_panfrost_free_job(tmpfd, submit);
+                close(tmpfd);
+        }
+
         igt_fixture {
                 close(fd);
         }
-- 
2.31.1



More information about the igt-dev mailing list