From f7b961ddff32ac7d75d81624331cfbce91839089 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 18 Jul 2017 22:02:22 -0600 Subject: [PATCH] Reduce scope of contexts lock --- src/syscall/process.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 4b3f637c79..1138fa63cd 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -614,8 +614,8 @@ pub fn exec(path: &[u8], arg_ptrs: &[[usize; 2]]) -> Result { drop(path); // Drop so that usage is not allowed after unmapping context drop(arg_ptrs); // Drop so that usage is not allowed after unmapping context - let contexts = context::contexts(); let (vfork, ppid, files) = { + let contexts = context::contexts(); let context_lock = contexts.current().ok_or(Error::new(ESRCH))?; let mut context = context_lock.write(); @@ -848,6 +848,7 @@ pub fn exec(path: &[u8], arg_ptrs: &[[usize; 2]]) -> Result { } if vfork { + let contexts = context::contexts(); if let Some(context_lock) = contexts.get(ppid) { let mut context = context_lock.write(); if ! context.unblock() {