From owner-freebsd-bugs@freebsd.org Tue Oct 3 10:51:19 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36B21E3840B for ; Tue, 3 Oct 2017 10:51:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25C7C6EA3E for ; Tue, 3 Oct 2017 10:51:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v93ApJQO021855 for ; Tue, 3 Oct 2017 10:51:19 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 222752] DTrace: probe syscall::write:entry is not fired unless printf in action Date: Tue, 03 Oct 2017 10:51:19 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: hannes@mehnert.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Oct 2017 10:51:19 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D222752 Bug ID: 222752 Summary: DTrace: probe syscall::write:entry is not fired unless printf in action Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: hannes@mehnert.org I'm using rev322062, compiled (cc -o t t.c) the t.c below, which is a quite small test case just for this bug. The lifecycle of t and DTrace are not equal - thus I try to communicate from the user application (t) to DTrace when to start instrumenting and when to stop. I do this by t writing START and STOP onto stdout, and the D script = to set a thread-local variable. The probe sysctl::write:entry in t.d is not executed - the same one in t2.d, where a printf is added - is executed. My expectation from DTace is that t= .d's sysctl::write:entry would also be executed. I execute "doas ./d.t" in one shell, then execute ./t in another shell.=20 (Running dtrace -c obviously works because DTrace then exits once t exits, = but this is not a solution for my use case (a much bigger instrumentation where= I only want to trace after some initialisation). t.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D #include #include int main (int argc, char ** argv) { printf("START"); printf("BOOOOOOOO\n"); printf("STOP"); printf("done now\n"); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D t.d =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D #!/usr/sbin/dtrace -Cs #pragma D option quiet #define prog "t" #define act execname =3D=3D prog && self->started =3D=3D 1 syscall::write:entry /arg0 =3D=3D 1 && (string)copyin(arg1, 5) =3D=3D "START"/ { self->started =3D 1; } syscall::write:entry /act && arg0 =3D=3D 1 && (string)copyin(arg1, 4) =3D=3D "STOP" && self->sta= rted =3D=3D 1/ { exit(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D t2.d =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D #!/usr/sbin/dtrace -Cs #pragma D option quiet #define prog "t" #define act execname =3D=3D prog && self->started =3D=3D 1 syscall::write:entry /arg0 =3D=3D 1 && (string)copyin(arg1, 5) =3D=3D "START"/ { printf("starting\n"); self->started =3D 1; } syscall::write:entry /act && arg0 =3D=3D 1 && (string)copyin(arg1, 4) =3D=3D "STOP" && self->sta= rted =3D=3D 1/ { printf("exiting now\n"); exit(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D --=20 You are receiving this mail because: You are the assignee for the bug.=