From 6f90ed16121e647dc72ab9863e70cc57bf0ffaeb Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Sat, 21 Jan 2017 06:04:22 -0500 Subject: [aot] Init the plt before setting acfg->methods_loaded which is accessed outside the lock. --- mono/mini/aot-runtime.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 941d5017d0f..2fd57cf8561 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -3936,15 +3936,18 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM amodule_lock (amodule); - InterlockedIncrement (&mono_jit_stats.methods_aot); - - amodule->methods_loaded [method_index / 32] |= 1 << (method_index % 32); - init_plt (amodule); + InterlockedIncrement (&mono_jit_stats.methods_aot); + if (method && method->wrapper_type) g_hash_table_insert (amodule->method_to_code, method, code); + /* Commit changes since methods_loaded is accessed outside the lock */ + mono_memory_barrier (); + + amodule->methods_loaded [method_index / 32] |= 1 << (method_index % 32); + amodule_unlock (amodule); if (mono_profiler_get_events () & MONO_PROFILE_JIT_COMPILATION) { -- cgit v1.2.3