sys.kern.pdeathsig.signal_delivered_ptrace: fix startup.
Inform D that C executed procctl(PROC_PDEATHSIG_CTL). Otherwise D might allow B to exit before C is set up to receive a signal on the parent exit. In this case, C waits forever for the signal and test hangs. PR: 237657 Reported and tested by: lwhsu Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
39ba52c0b7
commit
de567a4bef
@ -229,6 +229,7 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
|
||||
int rc;
|
||||
int pipe_ca[2];
|
||||
int pipe_db[2];
|
||||
int pipe_cd[2];
|
||||
char buffer;
|
||||
int status;
|
||||
|
||||
@ -236,6 +237,8 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
|
||||
ATF_REQUIRE(rc == 0);
|
||||
rc = pipe(pipe_db);
|
||||
ATF_REQUIRE(rc == 0);
|
||||
rc = pipe(pipe_cd);
|
||||
assert(rc == 0);
|
||||
|
||||
rc = fork();
|
||||
ATF_REQUIRE(rc != -1);
|
||||
@ -263,6 +266,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
|
||||
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
|
||||
assert(rc == 0);
|
||||
|
||||
rc = write(pipe_cd[1], "x", 1);
|
||||
assert(rc == 1);
|
||||
|
||||
/* wait for B to die and signal us... */
|
||||
signum = 0xdeadbeef;
|
||||
rc = sigwait(&sigset, &signum);
|
||||
@ -293,6 +299,9 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
|
||||
rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0);
|
||||
assert(rc == 0);
|
||||
|
||||
rc = read(pipe_cd[0], &buffer, 1);
|
||||
assert(rc == 1);
|
||||
|
||||
/* tell B that we're ready for it to exit now */
|
||||
rc = write(pipe_db[1], ".", 1);
|
||||
assert(rc == 1);
|
||||
|
Loading…
Reference in New Issue
Block a user