Skip to content

test/util: call destroy before reporting the result

Gert Wollny requested to merge gerddie/piglit:fix-exit-order into main

piglit_report_result calls exit which in turn calls destroy on the gl framework by using the exit handler. This conflicts with the Vulkan validation layer when the piglit runs on Zink: Because the context is created after "atexit" is called to set the destroy callback, and hence Zink and the (enabled) Vulkan validation layer is only called afterwards, the internal callback to clean up validation data structures is set after the piglit_gl_framework destroy callback is set.

Consequently the data structures in the Vulkan validation layer are destroyed before the GL context is cleaned up when exiting piglit via "exit" in "piglit_report_result". Because destroying the Zink context requires calling into Vulkan, and therefore, also calling into the Vulkan validation layer (if enabled), these data structures might be accessed, resulting in a use-after-free error, e.g. with object namespace pollution@buffer with glcopyimagesubdata

Therefore, when running the piglit test in a way that results in creating a GL context also call destroy before reporting the result and reset the global gl_framework pointer so that destroy is not tried a second time.

This only seems to be relevant for the fbo backend, but in order to reset the global "gl_framework" pointer the interface to "run_test" has to be changed to be able to update this pointer.

Signed-off-by: Gert Wollny gert.wollny@collabora.com

@zmike

Edited by Gert Wollny

Merge request reports

Loading