fix to missing exclusive processing between terminate() and

finalize_process().

The process of making a child process zombie and the process of setting
the parent of the child process to process ID 1 are excluded.

Refs: #1257
Change-Id: Ic95d4d8ee92d6a4a63847e5eda20ec1ba92566ac
This commit is contained in:
Tomoki Shirasawa
2019-02-08 10:25:20 +09:00
parent ff0395581c
commit d78883c692
5 changed files with 135 additions and 17 deletions

View File

@ -576,14 +576,18 @@ finalize_process(struct process *proc)
struct resource_set *resource_set = cpu_local_var(resource_set);
struct process *pid1 = resource_set->pid1;
int exit_status = proc->group_exit_status;
struct mcs_rwlock_node updatelock;
mcs_rwlock_writer_lock_noirq(&proc->update_lock, &updatelock);
// Send signal to parent
if (proc->parent == pid1) {
proc->status = PS_ZOMBIE;
mcs_rwlock_writer_unlock_noirq(&proc->update_lock, &updatelock);
release_process(proc);
}
else {
proc->status = PS_ZOMBIE;
mcs_rwlock_writer_unlock_noirq(&proc->update_lock, &updatelock);
dkprintf("terminate,wakeup\n");