To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 13805e3a authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Updated STRUCT_TAG_MAP and HYBRID_TAG_MAP to no longer use dlsym

parent a2b50bb1
......@@ -19,7 +19,8 @@ use utils::POINTER_SIZE;
use utils::vec_utils;
use std;
use rodal;
use std::sync::atomic::{Ordering, AtomicPtr};
use std::ptr;
use std::fmt;
use std::collections::HashMap;
use std::sync::RwLock;
......@@ -467,13 +468,24 @@ impl fmt::Display for MuType_ {
}
}
#[no_mangle]
pub static STRUCT_TAG_MAP_LOC: Option<AtomicPtr<RwLock<HashMap<StructTag, StructType_>>>> = None;
#[no_mangle]
pub static HYBRID_TAG_MAP_LOC: Option<AtomicPtr<RwLock<HashMap<HybridTag, HybridType_>>>> = None;
lazy_static! {
/// storing a map from MuName to StructType_
pub static ref STRUCT_TAG_MAP : RwLock<HashMap<StructTag, StructType_>> =
rodal::try_load_asm_name_move("STRUCT_TAG_MAP").unwrap_or(RwLock::new(HashMap::new()));
match &STRUCT_TAG_MAP_LOC {
&Some(ref ptr) => unsafe{ptr::read(ptr.load(Ordering::Relaxed))},
&None => RwLock::new(HashMap::new())
};
/// storing a map from MuName to HybridType_
pub static ref HYBRID_TAG_MAP : RwLock<HashMap<HybridTag, HybridType_>> =
rodal::try_load_asm_name_move("HYBRID_TAG_MAP").unwrap_or(RwLock::new(HashMap::new()));
match &HYBRID_TAG_MAP_LOC {
&Some(ref ptr) => unsafe{ptr::read(ptr.load(Ordering::Relaxed))},
&None => RwLock::new(HashMap::new())
};
}
rodal_struct!(StructType_{tys});
......
......@@ -27,7 +27,15 @@ extern void* rodal_realloc(void*, size_t);
extern uint32_t mu_retval;
extern void* STRUCT_TAG_MAP;
extern void* HYBRID_TAG_MAP;
extern void* STRUCT_TAG_MAP_LOC;
extern void* HYBRID_TAG_MAP_LOC;
int main(int argc, char** argv) {
STRUCT_TAG_MAP_LOC = &STRUCT_TAG_MAP;
HYBRID_TAG_MAP_LOC = &HYBRID_TAG_MAP;
rodal_init_deallocate();
mu_main(&RODAL_END, &vm, argc, argv);
return (int)mu_retval;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment