[Mesa-dev] [PATCH shader-db 2/2] run: Make crash handler more robust against late crashes.

Kenneth Graunke kenneth at whitecape.org
Tue Feb 28 01:53:21 UTC 2017


We might crash in the final eglTerminate and gbm_device_destroy
functions, or atexit() handlers, at which point we've freed the
current_shader_names array.  We shouldn't access it.
---
 run.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

We're still crashing in atexit() on a 72 core system, but we're at least
now not printing 72 lines of garbage from dangling pointers.

diff --git a/run.c b/run.c
index a675a77..ff65b5f 100644
--- a/run.c
+++ b/run.c
@@ -274,13 +274,17 @@ int max_threads;
 static void
 abort_handler(int signo)
 {
-    sigputs("\n => CRASHED <= while processing these shaders:\n\n");
-    for (int i = 0; i < max_threads; i++) {
-        if (current_shader_names[i]) {
-            sigputs("    ");
-            sigputs(current_shader_names[i]);
-            sigputs("\n");
+    if (current_shader_names) {
+        sigputs("\n => CRASHED <= while processing these shaders:\n\n");
+        for (int i = 0; i < max_threads; i++) {
+            if (current_shader_names[i]) {
+                sigputs("    ");
+                sigputs(current_shader_names[i]);
+                sigputs("\n");
+            }
         }
+    } else {
+       sigputs("\n => CRASHED <= during final teardown.\n");
     }
     sigputs("\n");
     _exit(-1);
@@ -751,6 +755,7 @@ main(int argc, char **argv)
     free(current_shader_names);
     free(shader_test);
     free(core.extension_string);
+    current_shader_names = NULL;
 
  egl_terminate:
     eglTerminate(egl_dpy);
-- 
2.11.1



More information about the mesa-dev mailing list