git: 1f8d845d1cdf - main - ptrace_test PT_SC_REMOTE: fix a race
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Apr 2025 20:45:07 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1f8d845d1cdfeaefa539df5f6f33bec3da65152c commit 1f8d845d1cdfeaefa539df5f6f33bec3da65152c Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-04-16 15:02:58 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-04-17 20:33:47 +0000 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 --- tests/sys/kern/ptrace_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index db681293f043..de411af6bc40 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -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;