Fix deadlock on thread->times_update in getrusage()

Set thread->in_kernel properly on exiting interrupt handler when entering
it from kernel mode.

Conflicts:
	arch/x86_64/kernel/cpu.c
	kernel/mem.c
This commit is contained in:
Masamichi Takagi
2018-03-06 13:23:03 +09:00
parent 7b4de6e6c2
commit 06b1b4f8ab
3 changed files with 8 additions and 5 deletions

View File

@@ -407,6 +407,9 @@ clone_thread(struct thread *org, unsigned long pc, unsigned long sp,
ihk_atomic_set(&thread->refcount, 2);
memcpy(&thread->cpu_set, &org->cpu_set, sizeof(thread->cpu_set));
/* New thread is in kernel until jumping to enter_user_mode */
thread->in_kernel = org->in_kernel;
/* NOTE: sp is the user mode stack! */
ihk_mc_init_user_process(&thread->ctx, &thread->uctx, ((char *)thread) +
KERNEL_STACK_NR_PAGES * PAGE_SIZE, pc, sp);