mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
zink: don't use screen ralloc context for screen::pipeline_libs
set_rehash will realloc this memory, which triggers a UAF on screen destroy
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37370>
(cherry picked from commit dfcdae378a)
This commit is contained in:
parent
8e7efd9822
commit
222fe87cab
3 changed files with 14 additions and 14 deletions
|
|
@ -4114,7 +4114,7 @@
|
|||
"description": "zink: don't use screen ralloc context for screen::pipeline_libs",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1324,14 +1324,14 @@ zink_init_grid_functions(struct zink_context *ctx)
|
|||
void
|
||||
zink_init_screen_pipeline_libs(struct zink_screen *screen)
|
||||
{
|
||||
_mesa_set_init(&screen->pipeline_libs[0], screen, hash_gfx_program<0>, equals_gfx_program<0>);
|
||||
_mesa_set_init(&screen->pipeline_libs[1], screen, hash_gfx_program<1>, equals_gfx_program<1>);
|
||||
_mesa_set_init(&screen->pipeline_libs[2], screen, hash_gfx_program<2>, equals_gfx_program<2>);
|
||||
_mesa_set_init(&screen->pipeline_libs[3], screen, hash_gfx_program<3>, equals_gfx_program<3>);
|
||||
_mesa_set_init(&screen->pipeline_libs[4], screen, hash_gfx_program<4>, equals_gfx_program<4>);
|
||||
_mesa_set_init(&screen->pipeline_libs[5], screen, hash_gfx_program<5>, equals_gfx_program<5>);
|
||||
_mesa_set_init(&screen->pipeline_libs[6], screen, hash_gfx_program<6>, equals_gfx_program<6>);
|
||||
_mesa_set_init(&screen->pipeline_libs[7], screen, hash_gfx_program<7>, equals_gfx_program<7>);
|
||||
_mesa_set_init(&screen->pipeline_libs[0], NULL, hash_gfx_program<0>, equals_gfx_program<0>);
|
||||
_mesa_set_init(&screen->pipeline_libs[1], NULL, hash_gfx_program<1>, equals_gfx_program<1>);
|
||||
_mesa_set_init(&screen->pipeline_libs[2], NULL, hash_gfx_program<2>, equals_gfx_program<2>);
|
||||
_mesa_set_init(&screen->pipeline_libs[3], NULL, hash_gfx_program<3>, equals_gfx_program<3>);
|
||||
_mesa_set_init(&screen->pipeline_libs[4], NULL, hash_gfx_program<4>, equals_gfx_program<4>);
|
||||
_mesa_set_init(&screen->pipeline_libs[5], NULL, hash_gfx_program<5>, equals_gfx_program<5>);
|
||||
_mesa_set_init(&screen->pipeline_libs[6], NULL, hash_gfx_program<6>, equals_gfx_program<6>);
|
||||
_mesa_set_init(&screen->pipeline_libs[7], NULL, hash_gfx_program<7>, equals_gfx_program<7>);
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(screen->pipeline_libs_lock); i++)
|
||||
simple_mtx_init(&screen->pipeline_libs_lock[i], mtx_plain);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1483,6 +1483,11 @@ zink_destroy_screen(struct pipe_screen *pscreen)
|
|||
if (screen->gfx_push_constant_layout)
|
||||
VKSCR(DestroyPipelineLayout)(screen->dev, screen->gfx_push_constant_layout, NULL);
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(screen->pipeline_libs); i++) {
|
||||
ralloc_free(screen->pipeline_libs[i].table);
|
||||
screen->pipeline_libs[i].table = NULL;
|
||||
}
|
||||
|
||||
u_transfer_helper_destroy(pscreen->transfer_helper);
|
||||
if (util_queue_is_initialized(&screen->cache_get_thread)) {
|
||||
util_queue_finish(&screen->cache_get_thread);
|
||||
|
|
@ -1497,11 +1502,6 @@ zink_destroy_screen(struct pipe_screen *pscreen)
|
|||
#endif
|
||||
disk_cache_destroy(screen->disk_cache);
|
||||
|
||||
/* we don't have an API to check if a set is already initialized */
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(screen->pipeline_libs); i++)
|
||||
if (screen->pipeline_libs[i].table)
|
||||
_mesa_set_clear(&screen->pipeline_libs[i], NULL);
|
||||
|
||||
zink_bo_deinit(screen);
|
||||
util_live_shader_cache_deinit(&screen->shaders);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue