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");

View File

@ -26,14 +26,20 @@ org="`pwd`"
for i in {1..100}; do
sudo ./mck-stop.sh >> "$org/C1201T01.log" 2>&1
sudo ./mck-boot.sh >> "$org/C1201T01.log" 2>&1
./mck-mcexec.sh ./killit -np 8 -t 2000 - ./signalonfork \
-nosignal >> "$org/C1201T01.log" 2>&1
if [ "X$?" = X0 ]; then
echo -n .
else
echo
for j in {1..10}; do
./mck-mcexec.sh ./killit -np 8 -t 2000 - \
./signalonfork \ -nosignal >> \
"$org/C1201T01.log" 2>&1
if [ "X$?" = X0 ]; then
echo -n .
else
ng=1
break
fi
done
echo
if [ "X$ng" = X1 ]; then
echo C1201T01: NG see C1201T01.log
ng=1
break
fi
done

View File

@ -1,18 +1,118 @@
Script started on Tue Jan 22 12:16:17 2019
Script started on Tue Jan 29 09:56:27 2019
bash-4.2$ make test
sh ./C1201.sh
C1201T01 START
....................................................................................................
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
..........
C1201T01: OK
fork01 1 TPASS : fork() returned 22030
fork01 2 TPASS : child pid and fork() return agree: 22030
fork01 1 TPASS : fork() returned 12252
fork01 2 TPASS : child pid and fork() return agree: 12252
*** C1201T02: fork01 OK (2)
fork02 0 TINFO : Inside parent
fork02 0 TINFO : Inside child
fork02 0 TINFO : exit status of wait 0
fork02 1 TPASS : test 1 PASSED
*** C1201T03: fork02 OK (1)
fork03 0 TINFO : process id in parent of child from fork : 22181
fork03 0 TINFO : process id in parent of child from fork : 12402
fork03 1 TPASS : test 1 PASSED
*** C1201T04: fork03 OK (1)
fork04 1 TPASS : Env var TERM unchanged after fork(): xterm
@ -50,4 +150,4 @@ fork11 1 TPASS : fork test passed, 100 processes
bash-4.2$ exit
exit
Script done on Tue Jan 22 12:52:39 2019
Script done on Tue Jan 29 14:27:41 2019

View File

@ -1,10 +1,18 @@
【Issue#1201 動作確認】
【Issue#1201, Issue#1257 動作確認】
□ テスト内容
Issue#1201 と Issue#1257 は 共に stress-6-1-signalonfork-001 でプロセス残留
が発生するもので、現象と発生頻度が異なる。
Issue#1201 はプロセスが PS_EXITED 状態で残留し、スレッドも残留する。概ね
10数回に1回の頻度で発生する。
Issue#1257 はプロセスが PS_ZOMBIE 状態で残留するが、スレッドは残留しない。
概ね 200 回程度に 1 回の頻度で発生する。
このため、2 件の Issue のテストは共通に行うことにした。
テスト内容は以下の通りである。
1. Issue 指摘事項の再現確認
C1201T01 stress-6-1-signalonfork-001 を 100 回連続で正常終了することを確認。
対策前は 20 回程度の連続実行で確実に再現するため、100 回の連続実行
で発生しなければ対策されたと判断する。
C1201T01 stress-6-1-signalonfork-001 を 1000 回連続で正常終了することを確認。
発生頻度が低い Issue#1257 でも 200 回程度の連続実行で確実に再現する
ため、1000 回の連続実行で発生しなければ対策されたと判断する。
2. LTP を用いて既存処理に影響しないことを確認
プロセス生成処理関連を変更したため、fork のテストを選定した。