Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2018-10-18 10:15:29 +0300
committerGitHub <noreply@github.com>2018-10-18 10:15:29 +0300
commitd80ced607b499390e7fd4c211adf58c5e1be5575 (patch)
treef52ff5aa7ce7b02fd0b5d67659b2845507065b5f
parentd07c626a7484f82ef069af080a5fc90d06b19149 (diff)
[aot] Ensure shared got entries are initialized before loading methods (#11225)
[2018-06] [aot] Ensure shared got entries are initialized before loading methods Backport of #11190. /cc @luhenry @BrzVlad Description: Executing aot code that uses them would crash. Fixes random csc crashes. <!-- Thank you for your Pull Request! If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed. Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number -->
-rw-r--r--mono/mini/aot-runtime.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c
index d7c7f5c7ecb..4aa032a1a16 100644
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -105,7 +105,7 @@ typedef struct MonoAotModule {
guint32 image_table_len;
gboolean out_of_date;
gboolean plt_inited;
- gboolean got_initializing;
+ gboolean got_initialized;
guint8 *mem_begin;
guint8 *mem_end;
guint8 *jit_code_start;
@@ -1942,10 +1942,15 @@ init_amodule_got (MonoAotModule *amodule)
int i, npatches;
/* These can't be initialized in load_aot_module () */
- if (amodule->shared_got [0] || amodule->got_initializing)
+ if (amodule->got_initialized)
return;
- amodule->got_initializing = TRUE;
+ mono_loader_lock ();
+
+ if (amodule->got_initialized) {
+ mono_loader_unlock ();
+ return;
+ }
mp = mono_mempool_new ();
npatches = amodule->info.nshared_got_entries;
@@ -1991,6 +1996,10 @@ init_amodule_got (MonoAotModule *amodule)
}
mono_mempool_destroy (mp);
+
+ mono_memory_barrier ();
+ amodule->got_initialized = TRUE;
+ mono_loader_unlock ();
}
static void