mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
compiler/glsl: Use mutex lock while freeing up mem_ctx
builtin_builder::~builtin_builder() and builtin_builder::release() are running into race condition. This leads lightsmark to crash at the end because both calls ralloc_free which mutates the arguments state This patch fixes lightsmark2008 crash Fixes:e4da8b9c33("mesa/compiler: rework tear down of builtin/types") Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: Neha Bhende <bhenden@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Neha Bhende <bhenden@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11385> (cherry picked from commiteb272f6571)
This commit is contained in:
parent
c4e33a4ed7
commit
482e34c78a
2 changed files with 11 additions and 2 deletions
|
|
@ -787,7 +787,7 @@
|
|||
"description": "compiler/glsl: Use mutex lock while freeing up mem_ctx",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "e4da8b9c331cc3ae1b86b3a7860231e202463db0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@
|
|||
|
||||
using namespace ir_builder;
|
||||
|
||||
static mtx_t builtins_lock = _MTX_INITIALIZER_NP;
|
||||
|
||||
/**
|
||||
* Availability predicates:
|
||||
* @{
|
||||
|
|
@ -1296,7 +1298,15 @@ builtin_builder::builtin_builder()
|
|||
|
||||
builtin_builder::~builtin_builder()
|
||||
{
|
||||
mtx_lock(&builtins_lock);
|
||||
|
||||
ralloc_free(mem_ctx);
|
||||
mem_ctx = NULL;
|
||||
|
||||
ralloc_free(shader);
|
||||
shader = NULL;
|
||||
|
||||
mtx_unlock(&builtins_lock);
|
||||
}
|
||||
|
||||
ir_function_signature *
|
||||
|
|
@ -7753,7 +7763,6 @@ builtin_builder::_helper_invocation()
|
|||
|
||||
/* The singleton instance of builtin_builder. */
|
||||
static builtin_builder builtins;
|
||||
static mtx_t builtins_lock = _MTX_INITIALIZER_NP;
|
||||
static uint32_t builtin_users = 0;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue