radeonsi: Refuse to accept code with unhandled relocations
authorJan Vesely <jan.vesely@rutgers.edu>
Tue, 17 Jul 2018 01:22:22 +0000 (21:22 -0400)
committerJan Vesely <jan.vesely@rutgers.edu>
Wed, 18 Jul 2018 17:56:56 +0000 (13:56 -0400)
They might lead to unrecoverable GPU hang.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable@lists.freedesktop.org
src/gallium/drivers/radeonsi/si_compute.c

index 5d3341ff61eae10d7c7eabb8d57bc4c0d5be4973..2349be95849a2d13d1077c8c8e4d7d36e142cdaa 100644 (file)
@@ -238,6 +238,12 @@ static void *si_create_compute_state(
                        const amd_kernel_code_t *code_object =
                                si_compute_get_code_object(program, 0);
                        code_object_to_config(code_object, &program->shader.config);
+                       if (program->shader.binary.reloc_count != 0) {
+                               fprintf(stderr, "Error: %d unsupported relocations\n",
+                                       program->shader.binary.reloc_count);
+                               FREE(program);
+                               return NULL;
+                       }
                } else {
                        si_shader_binary_read_config(&program->shader.binary,
                                     &program->shader.config, 0);