From owner-freebsd-bugs@FreeBSD.ORG Sun Sep 16 06:00:30 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 951591065679 for ; Sun, 16 Sep 2012 06:00:30 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CF2D18FC14 for ; Sun, 16 Sep 2012 06:00:27 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8G60RMv077286 for ; Sun, 16 Sep 2012 06:00:27 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8G60Rto077272; Sun, 16 Sep 2012 06:00:27 GMT (envelope-from gnats) Resent-Date: Sun, 16 Sep 2012 06:00:27 GMT Resent-Message-Id: <201209160600.q8G60Rto077272@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mark Johnston Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 041B8106564A for ; Sun, 16 Sep 2012 05:56:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id E32098FC29 for ; Sun, 16 Sep 2012 05:56:15 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q8G5uFPd019079 for ; Sun, 16 Sep 2012 05:56:15 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id q8G5uFwJ019076; Sun, 16 Sep 2012 05:56:15 GMT (envelope-from nobody) Message-Id: <201209160556.q8G5uFwJ019076@red.freebsd.org> Date: Sun, 16 Sep 2012 05:56:15 GMT From: Mark Johnston To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/171678: [dtrace] dtrace -h doesn't work when io.d is installed X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Sep 2012 06:00:30 -0000 >Number: 171678 >Category: misc >Synopsis: [dtrace] dtrace -h doesn't work when io.d is installed >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Sep 16 06:00:27 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Mark Johnston >Release: CURRENT >Organization: >Environment: FreeBSD oddish.laptop 10.0-CURRENT FreeBSD 10.0-CURRENT #13 r240519+3cc2dea-dirty: Sat Sep 15 22:29:45 EDT 2012 mark@oddish.laptop:/usr/obj/usr/home/mark/src/freebsd/sys/GENERIC amd64 >Description: When running dtrace -h, I get the following unintuitive error message: $ dtrace -h -s perldtrace.d dtrace: failed to compile script perldtrace.d: "/usr/lib/dtrace/regs_x86.d", line 2: type redeclared: struct devinfo This error doesn't occur if I run it without -h, which doesn't make much sense since the scripts in /usr/lib/dtrace/ are processed regardless. >How-To-Repeat: >Fix: The root of the problem is the "#pragma D depends_on provider" in /usr/lib/dtrace/io.d. When dtrace sees that directive, it calls a DTRACEIOC_PROVIDER ioctl on /dev/dtrace/dtrace with the appropriate provider argument ("io" in this case) to verify that that provider really is available. Turns out that the -h (and -G) option sets the DTRACE_O_NODEV flag, which basically means "don't open /dev/dtrace/dtrace or /dev/dtrace/fasttrap." This allows dtrace -h to be used without needing root privileges. But obviously we need to open /dev/dtrace/dtrace for the reason mentioned above, and dtrace aborts because it can't call the ioctl. For now, I'm working around this by just removing /usr/lib/dtrace/io.d - I don't need it at the moment. I'm not sure what the right fix is. Probably the error message could also be improved in this case, but I haven't really looked into that. >Release-Note: >Audit-Trail: >Unformatted: