ptrace_test PT_SC_REMOTE: fix a race

Only one of PT_TRACE_ME/PT_ATTACH is needed.  Having them both causes
the race between parent and child on the attachment way.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D49678
This commit is contained in:
Konstantin Belousov
2025-04-16 18:02:58 +03:00
parent a6b7d5cdda
commit 1f8d845d1c
+4 -1
View File
@@ -4378,7 +4378,10 @@ ATF_TC_BODY(ptrace__PT_SC_REMOTE_getpid, tc)
exit(0);
}
attach_child(fpid);
wpid = waitpid(fpid, &status, 0);
REQUIRE_EQ(wpid, fpid);
ATF_REQUIRE(WIFSTOPPED(status));
REQUIRE_EQ(WSTOPSIG(status), SIGSTOP);
pscr.pscr_syscall = SYS_getpid;
pscr.pscr_nargs = 0;