Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys ATF: Correct a race bug in attach2 (t_ptr...



details:   https://anonhg.NetBSD.org/src/rev/b0ca7f6c849e
branches:  trunk
changeset: 831000:b0ca7f6c849e
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Mar 07 10:53:55 2018 +0000

description:
ATF: Correct a race bug in attach2 (t_ptrace_wait*)

At the end of the test we resume a tracer and expect to observe it to
collect the debuggee. We cannot from a parent point of view wait for
collecting it with WNOHANG without a race.

Remove the WNOHANG option from wait*(2) call. This corrects one type of
race.

This test is still racy for some other and unknown reason and this is being
investigated.

Sponsored by <The NetBSD Foundation>

diffstat:

 tests/lib/libc/sys/t_ptrace_wait.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b34a6de3e3a1 -r b0ca7f6c849e tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c        Wed Mar 07 10:06:41 2018 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c        Wed Mar 07 10:53:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.23 2018/03/05 11:24:34 kamil Exp $ */
+/*     $NetBSD: t_ptrace_wait.c,v 1.24 2018/03/07 10:53:55 kamil Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.23 2018/03/05 11:24:34 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.24 2018/03/07 10:53:55 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -500,7 +500,7 @@
 
        DPRINTF("Wait for tracee to finish its job and exit - calling %s()\n",
            TWAIT_FNAME);
-       TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG),
+       TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, 0),
            tracee);
 
        validate_status_exited(status, exitval_tracee);



Home | Main Index | Thread Index | Old Index