execve: fix execve with oversubscribing

Issue: #1072
Change-Id: I88446e075b60de3c94cad2a19a4731e58037ea63
This commit is contained in:
Dominique Martinet
2018-06-18 14:38:26 +09:00
parent d4471df94e
commit ec202a1ca9

View File

@@ -2245,6 +2245,8 @@ SYSCALL_DECLARE(execve)
/* Unmap all memory areas of the process, userspace will be gone */
munmap_all();
/* Code assumes no process switch from here on */
preempt_disable();
ihk_mc_init_user_process(&thread->ctx, &thread->uctx,
((char *)thread) +
KERNEL_STACK_NR_PAGES * PAGE_SIZE, desc->entry, 0);
@@ -2308,12 +2310,16 @@ end:
/* Lock run queue because enter_user_mode expects to release it */
cpu_local_var(runq_irqstate) =
ihk_mc_spinlock_lock(&(get_this_cpu_local_var()->runq_lock));
preempt_enable();
ihk_mc_switch_context(NULL, &thread->ctx, thread);
/* not reached */
return -EFAULT;
}
/* no preempt_enable, errors can only happen before we disabled it */
return ret;
}