dtrace: prevent forked child from running after an error condition
The pid/killonerror test uses an invalid probe specifier to verify that the child process is killed. It occasionally fails because the "date" command is allowed to run long enough to print the date. This is harmless in this case, but is clearly not ideal. When the dt_proc_control thread is about to exit, and the dtrace command forked the child, do not make the child runnable. Reviewed by: markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D40976
This commit is contained in:
parent
df56c8069a
commit
dad11f990e
@ -685,9 +685,19 @@ dt_proc_control(void *arg)
|
||||
break;
|
||||
}
|
||||
|
||||
if (Pstate(P) != PS_UNDEAD && Psetrun(P, 0, 0) == -1) {
|
||||
dt_dprintf("pid %d: failed to set running: %s\n",
|
||||
(int)dpr->dpr_pid, strerror(errno));
|
||||
if (Pstate(P) != PS_UNDEAD) {
|
||||
if (dpr->dpr_quit && (proc_getflags(P) & PR_KLC)) {
|
||||
/*
|
||||
* We're about to kill the child, so don't
|
||||
* bother resuming it. In some cases, such as
|
||||
* an initialization error, we shouldn't have
|
||||
* started it in the first place, so letting it
|
||||
* run could be harmful.
|
||||
*/
|
||||
} else if (Psetrun(P, 0, 0) == -1) {
|
||||
dt_dprintf("pid %d: failed to set running: "
|
||||
"%s\n", (int)dpr->dpr_pid, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
(void) pthread_mutex_unlock(&dpr->dpr_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user