Explorar o código

Do not overwrite static TCB

Jeremy Soller %!s(int64=2) %!d(string=hai) anos
pai
achega
f5651b22ea
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/ld_so/linker.rs

+ 4 - 2
src/ld_so/linker.rs

@@ -230,8 +230,10 @@ impl Linker {
             if self.next_tls_module_id == 0 {
                 // Hack to allocate TCB on the first TLS module
                 unsafe {
-                    let tcb = Tcb::new(master.offset).expect_notls("failed to allocate TCB");
-                    tcb.activate();
+                    if Tcb::current().is_none() {
+                        let tcb = Tcb::new(master.offset).expect_notls("failed to allocate TCB");
+                        tcb.activate();
+                    }
                 }
             }
             self.next_tls_module_id += 1;