Skip to content

Commit

Permalink
[mono] Fix a race in gparam construction. (#83688)
Browse files Browse the repository at this point in the history
Re: #81123.
  • Loading branch information
vargaz authored Mar 20, 2023
1 parent dcd0506 commit 059898f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mono/mono/metadata/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -3734,12 +3734,14 @@ publish_anon_gparam_fast (MonoImage *image, MonoGenericContainer *container, gin
if (!*cache) {
mono_image_lock (image);
if (!*cache) {
*cache = (MonoGenericParam*)mono_image_alloc0 (image, sizeof (MonoGenericParam) * FAST_GPARAM_CACHE_SIZE);
MonoGenericParam *new_cache = (MonoGenericParam*)mono_image_alloc0 (image, sizeof (MonoGenericParam) * FAST_GPARAM_CACHE_SIZE);
for (guint16 i = 0; i < FAST_GPARAM_CACHE_SIZE; ++i) {
MonoGenericParam *param = &(*cache)[i];
MonoGenericParam *param = &new_cache[i];
param->owner = container;
param->num = i;
}
mono_memory_barrier ();
*cache = new_cache;
}
mono_image_unlock (image);
}
Expand Down

0 comments on commit 059898f

Please sign in to comment.